Skip to content

Tag: matplotlib

Connecting means in seaborn box plot

I want to connect box plot means. I can do the basic part but cannot connect box plot means and box plots offset from x axis. similar post but not connecting means Python: seaborn pointplot and boxplot in one plot but shifted on the x-axis As we can see the sns.line plot does not follow the means and box plot…

How to update a NetworkX plot in real-time?

I’m trying to update a networkx plot using matplotlib in a canvas, but it adds a new plot to the graph each time instead of updating the graph below, I had to add the call to nx.draw_networkx() function to get it to update and I’m not sure if this is part of the issue. Example Code: Answer I have …

Seaborn expands X axis dates back to year 2000

I have a pandas dataframe that contains dates starting at 2017-09-01 (which I believe is in the correct format for a dataframe date). But the X axis is expanded dramatically. I do not have any outliers on the LHS. Answer Pandas and matplotlib’s dates sometimes don’t go along well. You can set the …

Annotate 3D scatter plot on pick event

I want to show annotations on a 3D scatter plot when the user clicks on a point. The code I have shows the annotation once I move the plot after I click on a point. How can I make the annotation appear as soon as the user clicks on a point, without having to move the plot? Answer Add fig.canvas.draw_idle()

How to change spines linewidth in 3D plot?

When you have a 2D plot in matplolib you can change the line width of spines (the containing box) as follows: Figure with thick spines: However this same methodology does not work for 3D plots. How could I change the axes line thickness for a 3D plot? Answer You can do this using the following code. I adapted…