All Questions
54
questions
0
votes
0
answers
33
views
Plotting problems in python script vs jupyter notebook
I am encountering issues with my plotting code when running it as a Python script in PyCharm. The plots overlap, and the legends are not displayed, which does not happen when I run the same code in a ...
0
votes
1
answer
58
views
How to have a figure legend and a subplot legend
I would like to plot some data in subplots and I would like to have a legend for the overall figure but also a legend for one of the subplots, where the labels of the subplot should not appear in the ...
0
votes
1
answer
291
views
Problem with handling multiple legends in subplots when you use plt.twinx()
I'm struggling to pass the list of my subplots with different scales on sides using plt.twinx() in each subplot to show all labels in a single legend box, but I get the following error:
...
0
votes
0
answers
41
views
Optimal legend placement after y-axis limiting
I've a fig with two subplots, I want them to have the same y-scale.
fig, ax = plt.subplots(1, 2,figsize=(10,6))
ax[0].set_title('Over Global region, {} points'. Format(len(df)))
ax[0].plot(df.groupby(...
1
vote
1
answer
149
views
Matplotlib scatterplot subplot legends overwrite one another
I have a scatterplot figure with subplots generated using a for loop. Within the figure, I am trying to create a single legend but each time a subplot and legend is rendered the legend is overwritten ...
0
votes
1
answer
90
views
matplotlib: common legend to a column in a subplots
Suppose the below code is used to create my plot:
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)
fig, axs = plt.subplots(2, 2)
axs[0, 0].plot(x, y)
axs[0, 0].set_title('Axis [0, 0]')
axs[0, 1]....
0
votes
0
answers
29
views
Is it possible to set generic legend next to four subplots matplotlib?
I have the following code:
x1 = np.linspace(0, 5, 10)
y1 = x1 + np.random.randn(10)
y2 = x1 + np.random.randn(10)
x2 = np.linspace(0, 5, 10)
y3 = x2 + np.random.randn(10)
y4 = x2 + np.random.randn(10)...
0
votes
1
answer
855
views
How to Remove duplicate labels in subplot legend
The following code will generate a legend with duplicated labels. How to remove the duplicated one, so that there is only 1 label1 and 1 label2? One possible approach is to remove the duplicated item ...
-1
votes
1
answer
150
views
Barplot subplot legend python
Hello everyone how can i make legend for 3 different bar color that code with subplot?
Data frame:
This is my code:
fig,axs = plt.subplots(2,3, figsize=(30,20))
axs[0,1].bar(x = df_7_churn_tenure['...
2
votes
1
answer
629
views
Legend in subplots() for vertical lines Matplotlib.pyplot Python
I am trying to do EDA with the Kaggle dataset link
I made a plot with 3 subplots and have plotted 3 vertical lines on the basis of mean, median and mode. is there any way to show these 3 lines in a ...
0
votes
1
answer
150
views
Sizing figure with variable number of subplots and 2 legends
I'm having a really hard time attempting to properly size a figure with a variable number of subplots (between 3 and 8) and 2 legends that should appear glued to each other.
I also checked every ...
1
vote
1
answer
773
views
How to align a single legend over two seaborn barplots?
I would like to have a single legend that nicely fits on top of both the subplots (doesn't necessarily need to span the entire width of the plots, but needs to be outside the plot). I know you can ...
0
votes
0
answers
95
views
Missing Labels from Legend With Subplots
I'm trying to plot multiple things in a figure with subplots.
When I try generating a legend for the figure, it is only showing labels for the data in the very last subplot, instead of for the entire ...
0
votes
1
answer
1k
views
python : using a subplot as legend for the others subplots
I have the script below that generates a plot consisted of 5 histograms (5 subplots) :
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
from scipy.optimize import ...
0
votes
1
answer
115
views
How to create three subplots where the height of the upper plot is lower?
I would like to create a plot that consists of three subplots, where the upper left plot has the same width as the lower left plot but 1/3 of the height. Besides, I'd also like to plot the legend in ...