I have a datframe with metric and grouping variables. I want to group the data by several grouping variables, do subplot and then export it to pdf. Right now I have a function which does subplots and returns it to another function. Then that function uses PdfPages to save the subplots to a pdf. However, the issue is that when number of subplots are way too many (like 200), it throws an error:-image size of 1296*96220 pixels is too large. I believe this is happening because my current codes are setup in such a way that it saved all the subplots to a single pdf page, making it a very large page. But then, that can go upto a limit, and since 200 charts are too many, I get this error. Because I have tried with 45 charts and it works. Note that data is in pandas dataframe and charting is done using matplotlib
Following is a rough idea of the code:
the first code takes in a dataframe, does a group by (can be multiple group by parameters) and then produces subplot. Imagine I have two groupby variables- A and B. so when i do subplot with the following code, I am expecting 20*15=300 subplots
grouped=df.groupby(grouping_vars)
fig,axs=plt.subplots( "some parameters")
fig.tight_layout
targets=zip(grouped.groups.keys(),axs.flatten())
for i,(key,ax) in enumerate(targets):
ax.plot("some parameters to plot based on group")
ax.set_title(key)
list_to_be_returned=[fig,plt]
return list_to_be_returned
Now, I use the following fucntion to save it to a pdf file
pp=Pdfpages(file_name)
pp.savefig(list_to_be_returned[0], bbox_inches='tight')
pp.close()
Now, what it does is puts all the subplots in a single large pdf page. I tried with 45 charts, and was successful. I am trying with 200 charts, and its throwing an error. Is there a way to instruct it to save maximum number of charts it can, on a single page, and then move on to next page once required.
everyone. I have a DataFrame in Python that comes from an Excel file. I want to display it as a visual chart. But one problem I'm having is that I can't display multiple Y-axes. I can only display one Y axes with one X axis. I want to compare multiple Data in y-axes.
I have multiple separate surfaces like below image:
I have their data in one data frame. How can I draw them? would you share Plotly python code to show me how can I draw them without using loops?
I want to draw a single graph using python with two columns excel sheet and use an excel sheet
You can use pandas.read_excel and then use the plotting functions.
I am very new to Python, but I am determined to learn how to use it. At the moment, I am working with .dat files that have a few columns only separated by spaces.
I was wondering if there is anyway that I can make a scatter plot with a specific column accompanied by each value's non-negative integer? (i.e. 0,1,2,3,4...).
Here is an example of the data I am working with:
Here is an example graph of what I would want to be the end result: