This question already has an answer here:
In matplotlib, what's the difference between title() and suptitle()?
(1 answer)
Closed 5 years ago.
I understand that matplotlib.figure.suptitle() adds a title to a figure.
But what does the "sup" stand for?
It is an abbreviation indicating a "super" title. It is a title which appears at the top of the figure, whereas a normal title only appears above a particular axes. If you only have one axes object, then there's unlikely an appreciable difference, but the difference happens when you have multiple subplots on the same figure and you would like a title at the top of the figure not on each of the axes objects.
Related
This question already has an answer here:
Is there a way to vary the thickness of a layer in sunburst diagram in plotly
(1 answer)
Closed last year.
I want to achieve this result but with plotly sunburst.
I can not find any parameter that controls the inner circle diameter in the documentation. It is any way to achieve that?
Unfortunately you can set only root_color. There is no attribute root_size. Just print help(go.sunburst.Root).
This question already has answers here:
Seaborn workaround for hue barplot
(4 answers)
Closed 2 years ago.
I tried to use the Seaborn style bar graph for one of my visualizations. To give more context, I had to group my data w.r.t fiscal quarter and customer, and aggregate the total revenue from each of these customers.
I have attached a .png file, which has the data frame and the code that I have written to plot this using sns.
Problem Statement: The vertical bars are not properly stacked. There is a gap between the second and third bar for 2019-Q2. Similarly, for Q3 and Q4. Can somebody help me understand the reason behind this?
the gaps are perhaps because you dont have any party with any amount for that quarter, So seaborn is reading it as zero. and since these are in an order it appreas as a gap in middle.
This question already has answers here:
How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?
(2 answers)
Closed 3 years ago.
I have a lot of data series (> 1000 bars). For this reason the plot is scaled very small. Do you know how I can activate a scrollbar in the plt.barh-chart with python? If I can set a fixed height of the bars then I can scroll through the > 1000 bars. Perhaps you have another solution for me?
You have to set position for scrollbar with respect to image size.
Kindly refer a below URL:
Scrollable Bar graph matplotlib
Could you provide a reproducible example? Other than that I can just give you plain advice. First of all, ask you whether you are really in need of Youtube/Netflix/etc. 1-10. Because it makes the chart very confusing. I came across the same problem some time ago too and I figured that the Gantt Chart from Plotly, particularly for Python, is a really good solution to make it clearer.
As for your original question:
fig= plt.figure(figsize=(6,3))
This question already has an answer here:
Remove the x-axis ticks while keeping the grids (matplotlib) [duplicate]
(1 answer)
Closed 5 years ago.
If I run this code
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.xaxis.set_tick_params(length=0,labelsize=0)
ax.grid(True)
I get the following:
The xaxis ticks and labels don't show (as expected), but some dashes appear on the bottom of the plot (the first three of which I have circled in red).
How can I remove them? I have looked at the documentation for grids, but can't find anything.
An answer which teaches me how I could have figured out how to do this by looking at the documentation would be particularly useful.
What you see are the ticklabels, which have size 0. Even zero sized ticks appear as a single dot because of antigraining.
You probably want to set the label off completely
ax.xaxis.set_tick_params(length=0,labelbottom=False)
You find out about this by looking at the available arguments in the documentation.
This question already has answers here:
How do I change the size of figures drawn with Matplotlib?
(14 answers)
Closed 5 years ago.
I have all of my graphs working, so now I am trying to scale my plots down to a relatively small size (3x3in). I added the figure command and the graph goes blank. Right size, just blank. I'm obviously missing something basic but it's beating me. When I comment it out, it shows fine ( if a bit big). When I include it, it blanks the image.
What am I doing incorrectly ?
plt.setp(line[lindex], linewidth=1.0)
plt.setp(line[lindex+1], linewidth=2.0)
plt.xlabel("Months")
plt.ylabel("Score")
plt.title(CurrAppName + "- by month")
plt.legend()
# plt.figure(figsize=(3,3))
plt.show()
If this is your whole code, just put the plt.figure(figsize=(3, 3)) as the first line. Here, declaring plt.figure(...) in the end means you are creating a whole new plot after you've drawn into the last one. You don't want that.