Tagged Questions
0
votes
0answers
14 views
Opening a matplotlib pyplot in a tkinter canvas - import error
I am trying to embed a pyplot in a tkinter canvas. I am using python 2.7 on Windows.
I looked around for some example code and I found the followingin the matplotlib documentation.
import matplotlib
...
-2
votes
0answers
14 views
Logic for defining Demarcation regions on graph
I'm currently having a few problems specify a demarcation region on my graph and would like some help in the semantics.
I have a few demarcation regions I have defined that work excellently well ...
0
votes
1answer
12 views
Graphs: contours, arrow and naming
I have to draw some graphics (pyplot preferred, but not mandatory), but on a very specific way. Here is an example of what I want:
I already know how to use pyplot to get most of the things I want.
...
0
votes
1answer
18 views
plotting circle in the graph using matplotlib
I have a graph plot and now I need a circle on it for every point where y equals zero. The graph works fine but the circle (code in the if statement) gives an error:
import numpy as np
import ...
0
votes
1answer
11 views
tabular legend layout for matplotlib
I have a plot with 9 lines, representing datasets with two varying parameters, say f_11, f_12, f_13, ..., f_33. To make the plot (a bit) clearer, I encode the first parameter as the color of the line ...
4
votes
1answer
65 views
R Lattice like plots with Python, Pandas and Matplotlib
I have a pandas dataframe of "factors", floats and integers. I would like to make "R Lattice" like plots on it using conditioning and grouping on the categorical variables. I've used R extensively and ...
-1
votes
1answer
28 views
Graphs in python using matplotlib
I wanted to plot y=(x+2)(x−1)(x−2) for x going from −3 to 3 using a dashed red line. When I wrote the following code, nothing shows up.
import numpy as np
import matplotlib.pyplot as plt
def ...
0
votes
1answer
17 views
Matplotlib: how to adjust zorder of second legend?
Here is an example that reproduces my problem:
import matplotlib.pyplot as plt
import numpy as np
data1,data2,data3,data4 = ...
1
vote
0answers
22 views
How do I change the interval between frames (python)?
So I'm making an animation in python using matplotlib.animation, and I want the time between each frame to change on every frame. According to everything I've found so far, the 'interval' arg can only ...
0
votes
1answer
24 views
Generating smooth line graph using matplotlib
Following is the python script to generate a plot using matplotlib.
#!/usr/bin/python
import matplotlib.pyplot as plt
import time
import numpy as np
from scipy.interpolate import spline
# Local ...
1
vote
0answers
32 views
Creating triangulated grid mesh using matplotlib
So I have been creating mesh's using software called BlueKenue for hydraulic models, which is great. In the document I am currently writing I would like to include an image of the mesh however the ...
-1
votes
2answers
33 views
How can i get python and matplotlib on my Ubuntu 14.04?
Okay so I tried to install matplotlib and python earlier from the command line. Turns out i probably already had python installed but it was not make(ing) plots. Then that didn't work so i tried to, ...
2
votes
0answers
20 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.
...
0
votes
2answers
21 views
Display numpy array in a for loop using matplotlib imshow
I have a numpy array whose elements are updated in a for loop:
a = np.array([[1,2,3],[4,5,6],[7,8,9]])
for t in range(0,10):
imshow(a)
for i in range(0,a.shape[0]):
for j in ...
2
votes
1answer
21 views
Row and column headers in matplotlib's subplots
What's the best practise to add a row and a column header to a grid of subplots generated in a loop in matplotlib? I can think of a couple, but not particularly neat:
For columns, with a counter to ...
2
votes
1answer
21 views
add frame and remove background colour and grids using seaborn.kdeplot
I have written a class to plot some data points. I used seaborn to make kernel density plot and it caused that (1) the frame gets disappeared and I would like a rigid frame and (2) there are grids in ...
2
votes
0answers
19 views
Changing the bit-depth of figures produced using Matplotlib
I'm using matplotlib to generate some figures via savefig. These figures are black and white and need to be saved at a very high resolution (1000 dpi) in TIFF format. It would therefore be beneficial ...
0
votes
2answers
26 views
paint several x,y series of values in one with matplotlib in python
I have two lists like the following:
values = [['2000', '246', '535', '461', '654', '522'], ['2000', '246', '535', '461', '654']]
levels = [['Levels', '200', '300', '400', '500', '600'], ['Levels', ...
0
votes
1answer
25 views
Unable to pie-plot my data in pandas python
I want to create a pie-plot that will show country values. I have a single column csv file that has list of countries where the users are from that I read into a pandas dataframe.
I've tried all sorts ...
0
votes
0answers
14 views
Creating two x-axes for a line-plot in matplotlib with unknown transform function between scales
Using matplotlib, two x-axes for 1 line plot can easily be obtained using twiny().
If the transform between the two x-scales can be described by a function, the corresponding ticks can be set by ...
0
votes
0answers
22 views
Set xrange in matplotlib
My data ranges from 0 to 360 in the x-axis.
When I do nothing, the plot will have an xrange from 0 to 400 with a step of 50.
When I do plt.xlim([0,360]), the x-axis only ranges from 0 to 350, also ...
0
votes
1answer
24 views
Contour plotting complex numbers and conjugates
I am trying to make a contour plot in python with complex numbers (i am using matplotlib, pylab).
I am working with sharp bounds on harmonic polynomials, but specifically right now I am trying to ...
0
votes
1answer
29 views
Matplotlib: How to get space between bars?
Hi I have started using matplotlib and have been trying to adapt the example code on the website to suit my needs. I have the code below which does what I want apart from the 3rd bar in each group ...
1
vote
0answers
23 views
Is it possible to set the marker edge alpha in Matplotlib?
For example, say I want to plot with color='None' but markeredgecolor='mediumseagreen' with the edges having alpha=0.5. Is that possible?
1
vote
0answers
21 views
CDF Cumulative Distribution Function Error
I am trying to plot a CDF for one column in multi-column data file. When only one column is present in data file it plots fine. When I try to grab a particular column from data it gives me error. I ...
0
votes
1answer
20 views
How to label parallels/meridian on orthographic projection using matplotlib/basemap in python
I am trying to label parallels/meridians on orthographic projection using matplotlib/basemap in python. According to the basemap documents labeling does not work for orthographic and some other ...
0
votes
1answer
36 views
How to hide <matplotlib.lines.Line2D> in IPython notebook
I am plotting an numpy array of values ,I ,on IPython notebook in %matplotlib inline mode using the plot command plt.plot(I,'o'). The resulting output is:
<matplotlib.figure.Figure at ...
0
votes
2answers
25 views
Python - plot only the outermost points of a dataset
I have a set of random points arranged in a square-like shape (with rough edges) and I would like to plot only the outermost points - only the points closest to the imaginary edge of the shape (so ...
0
votes
1answer
25 views
matplotlib - producing boxplots in a loop
I'd like to plot several boxplots in one figure, on one axis. The data that I use for the boxplots, however, is too large to be read into memory at once. So I read it in chunks using pandas ...
1
vote
0answers
19 views
Matplolib/pyplot: How to avoid rescaling?
I'm new at Python language and I'd like to put a 2D array with a "true" scale.Let me go with an example...
The array I'd like to plot has more blocks along the Y axis, than along X axis,but when I ...
0
votes
1answer
21 views
How do you set the axes on a histogram and swap the x and y axes?
I have a dataset where I want to plot a histogram of the number of measurements at each depth. I want to plot a histogram of each the frequency of measurements in the depth column. I want to bin the ...
0
votes
1answer
16 views
Polar plot axes labels for Cartopy
Is there any support yet to allow axes labels for polar plots Cartopy?
I note that using ax.gridlines(draw_labels=True) is only supported for PlateCarree and Mercator.
Additionally, ax.set_xticks ...
1
vote
1answer
16 views
change the python matplotlib colormap dynamic range for certain range
I have created a 2D gaussian function for display, the variable gauss (below) is in range of (0, 1). what I want to do is change the default colormap dynamic range from (black, white) to (gray, ...
2
votes
1answer
13 views
Cartopy subplot ticks & axes box line formatting
I'm using cartopy to plot several areas of very different sizes in different subplot arrangements (1x2, 3x4 etc.), which makes it quite difficult to find consistent layout parameters. One issue is ...
1
vote
1answer
21 views
Python: position text box fixed in corner and correctly aligned
I'm trying to mimic the legend method in matplotlib.pyplot where one can use loc='lower right' to position the legend box fixed and properly aligned no matter the axis and the content of the box.
...
1
vote
0answers
15 views
python gridspec, trouble sharing x and y axis
I'm doing a multi panel plot using gridspec, but I'm having a few issues. I want each row to share a different y axis and each column to share a different x axis. Or, in other words, to share x per ...
-1
votes
1answer
12 views
Adding a crosshair or marker to a matplotlib contour plot
I am plotting an NumPy array as a contour plot using matplotlib:
import numpy as np
import matplotlib.pyplot as plt
plt.contour(array, linewidths = 1, colors = 'k')
plt.contourf(array, cmap = ...
1
vote
1answer
18 views
Referencing Data From a 2D Histogram
I have the following code that reads data from a CSV file and creates a 2D histogram:
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
#Read in CSV ...
1
vote
1answer
18 views
Python combining the format method with long strings that use LaTeX
I'm trying to write a long string with several LaTeX commands and variables to an image. I'm having trouble setting an arbitrary precision for the variables while maintaining the LaTeX formatting.
...
1
vote
2answers
24 views
tkinter and matplotlib: windows not showing until program closes under Linux
I've written a program that basically plots different data upon pressing different buttons. The program works as intended under Windows, but when I tried to port it to Linux (Red Hat v6) I'm getting a ...
0
votes
0answers
13 views
Matplotlib - update figure on action that figure is not involved in
I have 2 monitors, one for dev, and the other displays some live matplotlib charts. I would like those charts to update, say, on key press event, but even when that action is away from the charts, ex. ...
0
votes
1answer
14 views
Putting the x-axis label on top of a plot in Python [duplicate]
this is just a quick question, I am making a plot , but want the label for x-axis to appear on the top rather than the bottom of the plot. I've managed to get the numbers along the axis on the top, ...
-2
votes
1answer
30 views
Python3:Plot f(x,y), preferably using matplotlib
Is there a way, preferably using matplotlib, to plot a 2-variable function f(x,y) in python;
Thank you, in advance.
0
votes
1answer
24 views
set second x axis zero position
I have a plot with second x-axis on top of my chart. How can I shift the zero position of this second axis on a specific value? I want the 0 position of the second x-axis to correspond with the value ...
1
vote
1answer
17 views
pyplot static color colormap
I'm using the following code to generate a pyplot with a colormap:
# Create a 3d plot
fig = pyplot.figure()
ax = fig.gca(projection='3d')
# Plot the frequency-time
ax.plot_surface(X, Y, Z, ...
0
votes
0answers
11 views
matplotlib inset_axis inset placement has tick labels overlapping parent axes
When I use inset_axes to place an inset in a figure, for small figure sizes, the tick labels for the inset will overlap the axes frame. Is there a way to make the figure adjust to avoid this problem?
...
0
votes
0answers
17 views
Ubuntu 14.04 cannot get python matplotlib working, it keep says require dateutil
When I import matplotlib in python, it keeps saying:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", ...
0
votes
1answer
21 views
Python Matplotlib: how to create a pie chart with variable values
I currently have a working program that creates pie charts similar to the similar code below:
import matplotlib.pyplot as plt
def get_name_counts(Names):
if "Bob" in Names:
NameList[0] ...
-1
votes
0answers
27 views
Using matplotlib to draw contours on top of a figure (Python)?
I have code for a figure with data for x, y, vx, and vy in txt files:
import matplotlib.pyplot as plt
import numpy as npy
...
-4
votes
1answer
47 views
How would I plot a function f(x,y) (technically a field) as a colour gradient in Pylab?
I am current trying to plot a function f(x,y), which is technically a vector A(r) and a field if I am being nit picky.
The plot:
I want the plot to be done over an XY graph, where f(x,y) is ...