Tagged Questions
6
votes
0answers
85 views
Insert image in matplotlib legend
I'd like to insert a couple small graphics (vector graphics but can be made raster if necessary) into the legend of a maplotlib plot. There would be one graphic per item in the legend.
I know I ...
4
votes
0answers
53 views
Confidence regions of 1sigma for a 2D plot
I have two variables that I have plotted using matplotlib scatter function.
I would like to show the 68% confidence region by highlighting it in the plot. I know to show it in a histogram, but I ...
4
votes
0answers
141 views
ImportError: No module named _gdbm matplotlib pickle
since matplotlib 1.3 matplotlib figures are pickle-able
When I try an example found on stackoverflow:
import matplotlib.pyplot as plt
import numpy as np
import pickle
ax = plt.subplot(111)
x = ...
4
votes
0answers
215 views
Specifying targets for intersphinx links to numpy, scipy, and matplotlib
Following the documentation for setting up Sphinx documentation links between packages, I have added
intersphinx_mapping = {'python': ('http://docs.python.org/2', None),
...
4
votes
0answers
261 views
Inset axes anchored to specific points in data coordinates?
I'd like to be able to overlay multiple inset axes on top of a set of parent axes, something like this:
Ideally, I'd like the anchor point of each set of inset axes to be fixed in data coordinates, ...
3
votes
0answers
41 views
Negative numbers don't display correctly in matplotlib xkcd style
I've been playing with the xkcd style feature in matplotlib. I have Matplotlib 1.4, and the humor sans font is installed correctly, or works in msword at least.
When I run the following example ...
3
votes
0answers
30 views
Matplotlib: Drag n Drop and blitting
I have created a FigureCanvaswhich allows drag and drop on all Textinstances. This works great for text within the axes, but for text outside the axes (such s axis labels), when the text is being ...
3
votes
0answers
36 views
Interactively changing the alpha value of matplotlib plots
I've looked at the documentation, but I can't seem to figure out if this is possible -
I have a dataset, with x and y values and discrete z values. Multiple pairs of (x,y) share the same z value. ...
3
votes
0answers
80 views
Embedded charts in PyCharm IPython console
Is there a way to allow embedded Matplotlib charts in the IPython console that is activated within PyCharm? I'm looking for similar behavior to what can be done with the QT console version of IPython, ...
3
votes
0answers
95 views
color matplotlib map using bicubic interpolation
I know that matplotlib and scipy can do bicubic interpolation:
http://matplotlib.org/examples/pylab_examples/image_interp.html
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html
...
3
votes
0answers
117 views
Compilation error ld: library not found for -lgcc_ext in MacOSX
I'm trying to replicate a tutorial example in the pyLearn2 documentation. When I run python make_dataset.py, in the example, I got this error:
11:17 $ python make_dataset.py
...
3
votes
0answers
48 views
Manual time loop control of FuncAnimation in matplotlib
I'm looking for something similar to FuncAnimation with blit, but instead of having a the library call a function at a fixed timestep, I want to call the function myself whenever I'm ready. I don't ...
3
votes
0answers
94 views
Matplotlib absolute text positioning
I am making movies from matplotlib plots and have been struggling with the absolute positioning of text() elements. The problem is that my text blocks, typically increasing numbers, keep moving around ...
3
votes
0answers
105 views
Facet wrap loses datetime format on x axis
When trying to facet wrap dataframe with dates on the x axis and values on the y axis, the dates all lose format. The relevant code below produces the attached graph. Any workarounds or solutions ...
3
votes
0answers
85 views
why the symbol '-' is omitted in 'y' axis when using science notation
I use matplotlib to do some plotting. But today I find out that it is very wired that in my plotting doesn't show the '-' on the y axis ticks. Could anyone give me some solutions for it? Thanks
The ...
3
votes
0answers
176 views
matplotlib.animation.ArtistAnimation Help, Animating pngs in matplotlib
I have been trying to animate a series of surface plots that I created for a 2D heat flow problem using finite element method. In order to be more efficient, I only solve and store the solution at one ...
3
votes
0answers
76 views
bar3d conflicts with plot_surface in matplotlib?
I want to draw bar graph with a map projected onto the xy plane with the following code:
#!/usr/bin/env python
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.cbook ...
3
votes
0answers
68 views
Adding the same Patch instance to multiple subplots in matplotlib
I am trying to add the same instance of a patch to multiple axes in matplotlib. Here is minimal example:
import matplotlib.pyplot as mpl_plt
import matplotlib.patches as mpl_patches
fig, (axes_1, ...
3
votes
0answers
75 views
In python using matplotlib how to display multiline strings in ax.fmt_xdata
I'm using matplotlib version 1.2.0 and python 2.7 on linux.
plot(numpy.arange(10))
ax = gca()
ax.fmt_xdata = lambda x: "line1 %d\nline2 %f"%(int(x),x)
On linux using the Qt4Agg backend it does ...
3
votes
0answers
435 views
AttributeError: 'numpy.ndarray' object has no attribute 'get_matrix'
I am trying to plot a wonderful PCA using mlpy, and the c argument to plt.scatter is causing an exception.
dataset: http://mlpy.sourceforge.net/docs/3.5/_downloads/iris.csv
import mlpy
from ...
3
votes
0answers
119 views
Why do i get KeyError: 'Patch' when using Spyder?
When i run the code using Spyder, I get a KeyError:'Patch' error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ...
3
votes
0answers
471 views
How to make matplotlib:pyplot resizeable with the Tkinter window in Python?
I am trying to build a grid of frames in each there is a matplotlib figure.
When I resize the window the figure remain with fix size and are not resizing to fit the empty space.
Is there a way to make ...
3
votes
0answers
236 views
Plotting a map : Rotating arrows for ocean surface currents
Here are the variables displayed by the netCDF file:
I have written this code in order to draw Mediterranean surface currents with a netCDF file :
import netCDF4
from netCDF4 import Dataset
import ...
3
votes
0answers
205 views
Group vertices in clusters using NetworkX
I am trying to represent graphically some graphs, and I need to group in clusters some nodes that have a common characteristics.
I am using NetworkX, and I need to do something similar with the graph ...
3
votes
0answers
214 views
picking on matplotlib legend when legend is outside of axes
I've run across and interesting quirk when I've modified the legend_picking.py example where the legend is outside of the axes as follows:
#leg = ax.legend(loc='upper left', fancybox=True, ...
3
votes
0answers
304 views
pyplot.show() reopens old tkinter dialog
EDIT: This seems to be a problem restricted to Tcl/Tk on Mac OS systems. So if you have no experience with that, this topic might be moot...
I want to have a Python script that does two things:
Ask ...
3
votes
0answers
256 views
How to insert non overlapping text in matplotlib?
I am trying to insert power flow results in a network plot created with matplotlib. Some buses are so close that labelling the names along with power flow results is proving to be a big headache ...
3
votes
0answers
219 views
Adding colormap to add_collection (surface in 3d plot)
I am making a 3 sided pyramid I have made the sides using add_collection3d(Poly3DCollection
But I want to add a colormap based on the z axis so that the top is red and it gradually change to blue but ...
3
votes
0answers
142 views
BufferRegion is cleared by a call to clf()
I have an application in which I'd like to draw counties from a shapefile using Basemap. Drawing the county polygons is the bottleneck in the rendering, and since I'll be drawing the same region of ...
3
votes
0answers
261 views
matplotlib - control capstyle of line collection/large number of lines
Similarly to a previous question of mine, I'd like to control the capstyle of lines being drawn using matplotlib. However, I have an extremely large number of lines, and drawing with anything other ...
3
votes
0answers
1k views
Matplotlib and Pyplot.close() not releasing memory? - backend related Qt4Agg
EDIT: If I explicity change the backend for matplotlib from 'Qt4Agg' to just 'Agg' then I am able to run my code with no errors. I assume this is a bug in the backend?
I am writing some code for ...
3
votes
0answers
483 views
How do I draw a colorbar in a gtk/glade window embedded matplotlib figure?
I am currently working on a gtk/python front-end to a simulation tool. I've got everything working as planned, with one exception- I can't figure out how to draw the colorbar associated with the plot ...
2
votes
0answers
35 views
matplotlib customizing axes shadow
I would like to customize the axes shadow in a matplotlib plot. the shadow looks unpropotionate to the other patches i am adding to the plot. I need dx and dy to be at least 4 to show the perspective ...
2
votes
0answers
17 views
Adding errorbars to 3D plot in matplotlib
I can't find a way to draw errorbars in a 3D scatter plot in matplotlib.
Basically, for the following piece of code
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
fig = ...
2
votes
0answers
21 views
Plotting circular 3d bars (discs) using matplotlib
I am trying to make a graphical visualization of reaction barriers in a cyclic reaction (cf. citric acid cycle).
I have barriers for two reaction paths closing the same reaction cycle through ...
2
votes
0answers
18 views
Matplotlib legend: labels above markers
I have a plot with multiple lines, each labelled separately. I'd like to put a legend in the plot so that individual lines can be identified. The default ordering of labels and markers looks something ...
2
votes
0answers
22 views
Matplotlib animation: how do I increase the “rate at which time passes” in an animation?
The obvious answer to this question would be "change the framerate". I can't seem to change the framerate beyond ~90 fps in matplotlib. Thus, my question: given a fixed framerate, how can I increase ...
2
votes
0answers
54 views
Make a bar of labels for a plot
I made the following plot with the following code and the data is here:
import numpy as np
import pylab as plt
from matplotlib import rc,rcParams
rc('text',usetex=True)
...
2
votes
0answers
30 views
Read/plot custom extension files
I have set of pre executed files and they are not with a known extensions like .txt or .csv or .dat. They have extensions from the process names like time0.1 time0.01 ans so on. When i am trying to ...
2
votes
0answers
19 views
Matplotlib 3d background always on top
I was trying to introduce a matplotlib Slider in my 3d plot for some real-time interaction...
The thing is, as I move the slider around, the background lines on the 3d surface keep rendering on top. ...
2
votes
0answers
24 views
How does matplotlib's radial axis scaling work by default?
I'm trying to plot some points using matplotlib with a polar projection. My impression was that the axes should automatically scale to fit the data, but that doesn't seem to be happening consistently.
...
2
votes
0answers
66 views
Logarithmically scaled minor tick marks on a matplotlib colorbar?
I'm having some trouble setting up a pcolormesh plot with a colorbar that includes logarithmically spaced minor tick marks on the colorbar.
The closest I've come is something like this:
import ...
2
votes
0answers
40 views
Matplotlib - Annotations overlapping on chart, how do I evenly distribute them vertically?
I have a chart, with 95% confidence intervals as patches. Naturally some of the data points overlap. Because of this, I need the point labels to be dynamically spaced so they are human readable. I ...
2
votes
0answers
33 views
Matplotlib set_data for errorbar plot
Matplotlib's line2D objects, such as those returned by a call to plot, have a convenient method, set_data, that let's me quickly update the values plotted by a single line without affecting the rest ...
2
votes
0answers
25 views
Matplotlib artists not pickable unless axes set?
I put some code in my FigureCanvas subclass in order to allow Text objects to be dragged with the mouse. Here are the relevant classes:
class MyCanvas(FigureCanvasQTAgg):
def __init__(self):
...
2
votes
0answers
58 views
Python colorbar scale
I have a question regarding the colorbar of the matplotlib. I have a surface-plot, which is working fine, and the colors are used correctly. But somehow, the scale of my colorbar is messed up. I think ...
2
votes
0answers
33 views
matplotlib: put legend symbols on the right of the labels
It's a simple thing but I've searched for quite a while without success: I want to customise a figure legend by reversing the horizontal order of the symbols and labels.
In Gnuplot, this is simply ...
2
votes
0answers
73 views
Converting text in Matplotlib when exporting .eps files
I'd like to be able to save Matplotlib plots and add them directly as vector graphics in Microsoft Word documents. However, the only format supported by Word and Matplotlib both is .eps, and the axis ...
2
votes
0answers
45 views
matplotlib: Convert between linewidth points and transAxes?
In many situations, I find it convenient to place square axes on a figure so that I can easily work in transAxes units without having to worry about the aspect ratio of the figure. However, one ...
2
votes
0answers
87 views
Matplotlib with Eclipse PyDev is not plotting
I have the following problem when using Matplotlib in Eclipse with PyDev.
import datetime
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sklearn
...
# Plot results
...