Skip to content
Advertisement

Tag: matplotlib

Matplotlib different size subplots

I need to add two subplots to a figure. One subplot needs to be about three times as wide as the second (same height). I accomplished this using GridSpec and the colspan argument but I would like to do this using figure so I can save to PDF. I can adjust the first figure using the figsize argument in the

Pip install Matplotlib error with virtualenv

I am trying to install matplotlib in a new virtualenv. When I do: or I get this error: Anyone have an idea what is going on? Any help much appreciated. Answer Building Matplotlib requires libpng (and freetype, as well) which isn’t a python library, so pip doesn’t handle installing it (or freetype). You’ll need to install something along the lines

How to plot a gradient color line in matplotlib?

To state it in a general form, I’m looking for a way to join several points with a gradient color line using matplotlib, and I’m not finding it anywhere. To be more specific, I’m plotting a 2D random walk with a one color line. But, as the points have a relevant sequence, I would like to look at the plot

When to use cla(), clf() or close() for clearing a plot in matplotlib?

Matplotlib offers these functions: When should I use each function and what exactly does it do? Answer They all do different things, since matplotlib uses a hierarchical order in which a figure window contains a figure which may consist of many axes. Additionally, there are functions from the pyplot interface and there are methods on the Figure class. I will

set matplotlib 3d plot aspect ratio

Setting the aspect ratio works for 2d plots: But does not for 3d: Is there a different syntax for the 3d case, or it’s not implemented? Answer My understanding is basically that this isn’t implemented yet (see this bug in GitHub). I’m also hoping that it is implemented soon. See This link for a possible solution (I haven’t tested it

How can I set the aspect ratio in matplotlib?

I’m trying to make a square plot (using imshow), i.e. aspect ratio of 1:1, but I can’t. None of these work: It seems like the calls are just being ignored (a problem I often seem to have with matplotlib). Answer Third times the charm. My guess is that this is a bug and Zhenya’s answer suggests it’s fixed in the

Elegantly changing the color of a plot frame in matplotlib

This is a kind of follow-up question to this post, where the coloring of axes, ticks and labels was discussed. I hope it is alright to open a new, extended question for this. Changing the color of a complete frame (ticks and axes) around a double-plot (via add_subplot) with axes [ax1, ax2] results in a lot of code. This snippet

Make matplotlib autoscaling ignore some of the plots

I use matplotib’s Axes API to plot some figures. One of the lines I plot represents the theoretical expected line. It has no meaning outside of the original y and x limits. What I want, is for matlplotlib to ignore it when autoscaling the limits. What I used to do, is to check what are the current limits, then plot,

Advertisement