How to Display Multiple Y-Axis in PANDASGUI? - python

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.

Related

How to save subplots in different pages of a single pdf using PDFPages

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.

Multiple bar plots in different figures but the same cell

I've been trying to plot multiple figures in one cell in Python. The internet shows me only how to put multiple bars in one figure but I want to have multiple figures. Could not find out how to do it yet. This is the bar plot I have so far:
I wanna do the same for other columns and not only 'workclass'. So basically, the same plot. Any ideas how to do that? Thank you in advance!

Plotly merge multiple figures in one figure and overlay plots on each other

So I have multiple figures each representing a scatter plot which changes with a slider that updates the plot according to the slider's value. Now I need to merge all those figures into one figure and have one general slider which will show all the plots overlapped. Is there a way in plotly to combine multiple figures (go.Figure() objects) so I can get my desired output?

Attempting to plot dataframe with specific rows as the lines and the columns as the xticks

I am trying to plot a line graph that shows multiple lines within my dataframe as the separate lines for comparison i.e. having one as the 'expected' and another to show variations. Additionally, I'm trying to show the columns as the xticks and percentages as the y values:
What I'm trying to show is row 1 as the 'expected' percent and then be able to use any other row i.e. food, bakery products, etc. to show any deviation for that across all columns (serving as the x-axis). I hope that this make sense and any help is appreciated!! I'm a new coder going through a bootcamp.

How to sit the size for seaborn pairplot chart?

I am trying to draw an sns.pairplot with one value in x_axis but multiple values in y_axis
This is what I got. All the figure in one row. Does Anyone know how I can get a bigger plot? or in multiple columns?
The chart is here:
As per the comment to your question, the reason that the plot is small, is because it does not fit into the Jupyter Notebook output cell. Try right clicking and opening in a new tab or saving it to a file.
If you want display the figure within a Notebook, you can make several calls to sns.pairplot with a subset of columns each time. You could also use sns.FaceGrid with plt.scatter for more granular control over what is plotted where.

Categories

Resources