Skip to content
Advertisement

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 plots

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 found

Seaborn histogram makes columns white

In what cases Seaborn makes histogram columns white? I use it Seaborn in Jupyter notebook: Then I plot histogram using this function: As a result in some cases I have histograms with all blue columns or some blue and some white or only white columns. Please, see attached pictures. How to make Seaborn always draw blue columns? Answer I believe

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 xlims explicitly as follows:

Matplotlib: changing the alpha of plotted image with AnnotationBox artist

This question is into relation with the following answer: https://stackoverflow.com/a/53851017/8814577 I’ve used the in the answer described method to drop images in a boxplot with AnnotionBox (from matplotlib.offsetbox) and it worked out great. However I’ve been searching but did not find an obvious solution to change the alpha channel (transparency) of the plotted image. I’ve been looking into trying to

Matlab equivalent to Python’s figsize

In Python’s matplotlib.pyplot the figsize command allows you to determine the figure size, eg. Is there an equivalent command in Matlab that does this? These old posts show different solutions but none are as clean as Python’s figsize. Answer Since you aim for saving/exporting your figure, you must pay attention to the right Figure Properties, namely: PaperPosition, PaperSize, and PaperUnits.

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 the idea

Advertisement