How to create curve plot with code output values(numerical error vs no. Of steps)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to create curve plot with code output values(numerical error vs no. Of steps)?

I have been trying to create code for FEA calculation, in which I get error value at each step. I want to create curve plot of same in Python. Can someone help me to overcome this. Thanks in advance.

25th Mar 2019, 5:09 AM
aniruddha jadhav
aniruddha jadhav - avatar
5 Answers
+ 2
For plotting and graphs, you can use the matplotlib library. https://matplotlib.org/users/pyplot_tutorial.html To understand your specific issue with the error message, post your code for review.
26th Mar 2019, 8:45 PM
Tibor Santa
Tibor Santa - avatar
+ 2
I fixed the graph for you. The trick is to store the error values in a list, then pass it to the plot. In this case the values are indexed automatically from 0,1, ... which will be the X coord. Actually there are many other ways you can pass the data to a plot, including numpy array or pandas dataframe. but this was the simplest. https://code.sololearn.com/cX0KigrjZV6N/#py
27th Mar 2019, 8:39 AM
Tibor Santa
Tibor Santa - avatar
+ 1
https://code.sololearn.com/cwYboA2H3j9I/?ref=app
27th Mar 2019, 5:39 AM
aniruddha jadhav
aniruddha jadhav - avatar
+ 1
Tibor Santa , please have look at code. I want to create surve for x,y which is output error from code.
27th Mar 2019, 5:40 AM
aniruddha jadhav
aniruddha jadhav - avatar
+ 1
Hm okay I will have to test it on a computer because it won't run on Sololearn due to the imports. I will try to get back to you later
27th Mar 2019, 5:56 AM
Tibor Santa
Tibor Santa - avatar