2
votes
0answers
12 views

Latex Citation in matplotlib Legend

I am generating figures for a technical paper using Python with matplotlib. Is there a way to include a Latex/Bibtex citation in the legend text? Ideally I would like a solution something like the ...
1
vote
2answers
38 views

How to equalize the scales of x-axis and y-axis in Python matplotlib?

I wish to draw lines on a SQUARE graph. The scales of x-axis and y-axis should be the same. e.g. x ranges from 0 to 10 and it is 10cm on the screen. y has to also range from 0 to 10 and has to be ...
1
vote
2answers
24 views

Imshow subplots with the same colorbar

I want to make 4 imshow subplots but all of them share the same colormap. Matplotlib automatically adjusts the scale on the colormap depending on the entries of the matrices. For example, if one of my ...
0
votes
0answers
29 views

Custom date range (x-axis) in time series with matplotlib

My code to plot a time series is this: def plot_series(x, y): fig, ax = plt.subplots() ax.plot_date(x, y, fmt='g--') # x = array of dates, y = array of numbers fig.autofmt_xdate() ...
2
votes
1answer
29 views

Pandas: boxplot of one column based on another column

Say I have a dataframe like the following: my_dataframe: Age Group 0 31 A 1 24 A 2 25 A 3 36 A 4 50 NaN 5 27 A 6 49 A 7 24 A 8 63 A 9 25 A 10 65 A 11 67 A 12 ...
1
vote
1answer
33 views

Saving to disk directly with matplotlib

I would like to save my figures to disk without rendering them on the screen and without having to change my rendering backend. I tried the instructions in here, namely avoiding calling fig.show() ...
1
vote
1answer
16 views

Is matplotlib.patches.FancyArrow not well behaved?

I found a rare behave on matplotlib when trying to plot some arrows. If you make a figure in the following way: import matplotlib.pyplot as plt import matplotlib.patches as patches arrow = ...
0
votes
0answers
17 views

Python Hexbin marginals offset from image produced

I have a hopefully simple question. When using the python hexbin plot option on some spatial data (Ra, and Dec are x and y) I also want to see the marginals on the side. Happily there is a simple ...
1
vote
1answer
21 views

pyplot legend label being truncated

I'm trying to create a legend that will contain the color of the line it corresponds to and the label. My current code is plotting the legend but is only plotting the first letter of the label (D ...
0
votes
0answers
30 views

After creating an array of matplotlib.figure.Figure, how do I draw them as subplots of One figure?

I have a method that returns an array of matplotlib.figure.Figure objects, I call pyplot.close() afterwards an keep the objects. I want to redraw those Figure objects as subplots of one Figure. It ...
0
votes
1answer
33 views

Matplotlib - Broken axis example: uneven subplot size

I haven't found a solution to adjust the height of the bottom and top plot of the broken axis example of matplotlib. BTW: The space between the two plots can be adjusted by: ...
1
vote
0answers
20 views

Use 3d object as marker in 3d scatter plot - Python

With the below code, I'm trying to model a bowl built out of cans. I would like for each marker to be a can, what would be the best way to go about this? I'd really appreciate any suggestions, ...
0
votes
2answers
35 views

Plotting surface of implicitly defined volume

Having a volume implicitly defined by x*y*z <= 1 for -5 <= x <= 5 -5 <= y <= 5 -5 <= z <= 5 how would I go about plotting its outer surface using available Python ...
1
vote
2answers
22 views

Discrete density plot in matplotlib

I have a 2D numpy array and I want to create a discrete density plot using it. Discrete in the sense that at each point (i,j) on the plot a dot should be placed whose color should correspond to the ...
0
votes
0answers
39 views

python/matplotlib hangs randomly on on savefig()

At times my code runs quickly and exits (for example: taking 2 seconds), at times it hangs (for example: up to minutes)*. This behavior seems to be completely random. After adding print statements ...
1
vote
1answer
30 views

Matplotlib not using latex font while tex.usetex==True

I want to create labels to my plots with the latex computer modern font. However, the only way to persuade matplotlib to use the latex font is by inserting something like: title(r'$\mathrm{test}$') ...
1
vote
1answer
29 views

How do I reuse a plot layout in iPython notebook>?

The code below gives me the image even further below. flowRates=[2,5,10,20,50] flowRateTol=0.2 #sets the limits for the plot xRange=(0,700) yRange=(0,70) ax=axes() ax.set_xlabel('Time (s)') ...
0
votes
1answer
30 views

Logarithmic y-axis bins in python

I'm trying to create a histogram of a data column and plot it logarithmically (y-axis) and I'm not sure why the following code does not work: import numpy as np import matplotlib.pyplot as plt data ...
0
votes
0answers
32 views

matplotlib contour plot with lognorm - colorbar levels

I am trying to make a contour plot with defined levels and log norm. Below is an example: import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LogNorm delta = 0.025 x = y ...
1
vote
0answers
40 views

Intelligibly displaying multiple (dense) scatter plots on one axis in Python-Matplotlib

I am trying to display scatterplots using Python and Matplotlib that plot data points belonging to one of several categories. I have decided to represent the categories by color with a legend, which ...
1
vote
1answer
50 views

Numpy reshape yields a different size error

I have a piece of Python code which has been used for about a year without any issues (it reads, uncompresses/unpacks data, selects a window and plots it using Numpy/Matplotplib). We recently got a ...
4
votes
1answer
60 views

How to label a line in Python?

I followed the documentation but still failed to label a line. plt.plot([min(np.array(positions)[:,0]), max(np.array(positions)[:,0])], [0,0], color='k', label='East') # West-East plt.plot([0,0], ...
0
votes
0answers
27 views

python.exe crashes when using matplotlib

This is what I did: Installed Enthought Canopy latest version, 64-bit, academic license Configured Canopy as default python interpreter Downloaded and installed Eclipse platform 4.2, 64-bit version ...
1
vote
1answer
50 views

Creating a stacked cylinder bar plot in matplotlib

Can matplotlib draw a stacked cylinder bar plot like the one below? How about if it has only one bar? If not, another option would be just a usual stacked bar plot with the bars having rounded edges ...
3
votes
2answers
68 views

How to make my pylab.poly1d(fit) pass through zero?

My code bellow produces a polyfit of the points in my graph, but I want this fit to always pass through zero, how do I do this? import pylab as pl import numpy as np y=(abs((UX2-UY2)+(2*UXY))) ...
4
votes
2answers
41 views

Adjusting gridlines on a 3D Matplotlib figure

I'm getting ready for a presentation and I have some example figures of 3D matplotlib figures. However, the gridlines are too light to see on the projected images. I tried using the grid-method that ...
1
vote
1answer
22 views

Matplotlib in wx application segfaults when plotting

I am writing my first wx application in python as a frontend to plotting in matplotlib. I successfully get my data into numpy arrays angles and col_cnts. However when I issue plt.plot I get the ...
2
votes
2answers
37 views

How to set x-axis labels on a figure plotted using matplotlib's pyplot?

I'm trying to plot sales and expenses values (on y-axis) over years (on x-axis) as given below. I'm expecting that the following code will set 2004, 2005, 2006 and 2007 as x-axis values. But, it is ...
-2
votes
0answers
42 views

Visualizing multidimensional cluster in python

I have a dataset with 10 features on each data point. I ran kmeans on it by doing: centroids, distortion = kmeans(data,k) idx,_ = vq(data,centroids) # assign each sample to a cluster Should I run ...
1
vote
1answer
28 views

Can't pass pandas Series to pyplot's fill_between function?

Passing a pandas Series to pyplot's fill_between() function produces the following error: <type 'exceptions.KeyError'> -1 However, other pyplot functions seem to be fine with taking Series as ...

1 2 3 4 5 126
15 30 50 per page