Tagged Questions
1
vote
1answer
15 views
horizontal bar plot: adjusting y axes label size
using pandas I tried to make a horizontal bar plot, but the y-axes label is cut off.
for the plot I used this data..
Term value
...
0
votes
0answers
24 views
plotting a scatter plot for list/array in matplotlib
It seems very trivial ,but I am not able to get past this simple problem. I fetch the first row of a very huge dataframe.
appleProd1 appleProd2 appleProd3 appleProd4 ..... 70 ...
1
vote
1answer
15 views
how to modify the autocorrelation default plot style and write the output of a acorr function to a dat/txt file?
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.mlab as mlab`
mu = np.loadtxt('my_data/corr.txt')
d = mu[:,2]
y=[]
tot=0
min=999
for i in d:
y.append(float(i))
...
0
votes
0answers
10 views
matplotlib stacked bar plot missing bars
I am attempting to make a stacked bar plot in python, however the final product seems to be missing bars. I believe the first bar should total around 36, but it doesn't. I'm not sure what I am doing ...
-1
votes
0answers
12 views
Change edge thickness based on weight [networkx]
When using draw_networkx_edges() of networkx, is it possible to change the thickness of the edges based on their weight?
Here I am assuming weights are less than some known number, say, k.
0
votes
1answer
17 views
Drawing only one triangle with RegularPolyCollection. Matplotlib
I've drawn three circles using CircleCollection and I want to plot only one triangle using RegularPolyCollection. My triangle's vertices are:
vertices = [2, 1], [8, 1], [5, 9]
I don't understand the ...
-1
votes
1answer
16 views
Using matplotlib to draw networkx graph with nodes of differing size
I have nodes in a graph "g" that are strings with a "size" attribute. The size attribute is based on the number of times a string occurs in a list "collabList"
for a in collabList :
if a in g :
...
1
vote
0answers
14 views
Can't use sphinx's matplotlib extension with Qt on OS X
Using the Anaconda python distribution on OS X, you can't use the anaconda/bin/python binary when using a Qt backend for matplotlib (via my matplotlibrc file). On import it causes:
Qt internal ...
0
votes
1answer
29 views
How to hide/remove legend line and retain the label
As I have shown in the figure:
I don't want to show the line in the legend but label, if it is possible please help to fix.
Have tried to minimise the present-legend's line and label and ...
1
vote
0answers
15 views
AxesSubplot has no attribute hist2d - Matplotlib
I am trying to draw a hist2d chart as one of a few subplots on a figure.
from matplotlib import pyplot as plt
ax = plt.subplot2grid( (3,3), (0,1) )
ax.hist2d(x_data, y_data, bins=50, cmap="Greens")
...
0
votes
1answer
15 views
What is the difference between setting the yscale in log and setting the y variable in log?
I would like to know what is the difference between:
ax.set_yscale('log')
ax.plot(a,b)
and
ax.plot(a,np.log10(b))
Here in the first case we are just setting the yscale to be a log scale.
In ...
0
votes
0answers
17 views
obtaining the data of a rectangle selection in matplotlib
I'm trying to understand the use of the RectangleSelector in matplotlib. Basically I'm plotting a 2D array with imshow and then I would like to select a rectangle portion with the mouse and save the ...
1
vote
1answer
13 views
Matplotlib pyplot axes formatter
I have an image:
Here in the y-axis I would like to get 5x10^-5 4x10^-5 and so on instead of 0.00005 0.00004.
What I have tried so far is:
fig = plt.figure()
ax = fig.add_subplot(111)
...
1
vote
1answer
26 views
Add x=y (45 degree) line within matplotlib axis limits
I'm on Matplotlib version 1.3.1 and mpl.get_backend() returns:
'module://IPython.kernel.zmq.pylab.backend_inline'
I have a plot with different x- and y-limits:
fig, ax = subplots(ncols=1)
...
1
vote
0answers
20 views
plot_surface in python griddata with x y with different dimensions [on hold]
I am trying to plot a 3d surface of data [x,y,z]. When I run the following the mlab.griddata function throw an attribute error 'list'object has no attribute 'ndim'
here is the code I am using
...
2
votes
1answer
45 views
Scatter plot for non numeric data
I am learning to use matplotlib with pandas and I am having a little trouble with it. There is a dataframe which has districts and coffee shops as its y and x labels respectively. And the column ...
0
votes
1answer
19 views
How to change color of plotted curves when using Animations in Python MatPlotLib?
I have a piece of code that uses the FuncAnimation method in Python MatPlotLib to generate 50 random Exponential Decay Curves and updating the plot showing each one other the curves as they re ...
1
vote
1answer
35 views
Python Pandas Subplot with Stacked data
I would like to produce plots (or subplots) of grouped data of a pandas dataframe. I think this should be something basic--I'm just missing something. I have input data that comes stacked that I ...
0
votes
2answers
25 views
Is there an algorithm that, given a point cloud, infers an optimal wireframe (surface) structure?
I have a point cloud that I would like to convert to a surface, in the form of a wireframe lattice structure.
This means, from a sequence of 3D points (x,y,z), obtaining three 2D matrices X,Y,Z of ...
-1
votes
2answers
35 views
why this a python script works on OSX and not on Windows?
I have a python script which runs perfectly on OSX.
After installing python, numpy and matplotlib on windows I cannot understand why the same does not run on windows.
Do you have any idea?
import ...
0
votes
0answers
38 views
Matplotlib agg complexity exceeding issue even with very small dataset
I've been trying to get some data to display in a matplotlib graph and I'm having an issue that seems fairly unexpected. I was originally trying to plot a large number of data points (~500000) and was ...
3
votes
2answers
93 views
How does imshow handle the alpha channel with an M x N x 4 input?
I am using the imshow function in matplotlib to visualize some data. What I have are two arrays, A and B, that are the same size. I would like to use a colormap to show scalar values in A, and I would ...
2
votes
1answer
34 views
matplotlib plotting in loop, removing colorbar but whitespace remains
My code is something (roughly) like this:
UPDATE: I've redone this with some actual mock-up code that reflects my general problem. Also, realized that the colorbar creation is in the actual loop as ...
0
votes
2answers
16 views
Discrete time-series graph with unknown y range
In a discrete time-series graph, I have tried replacing ax.plot(x,y) by ax.vlines(x,y):
I get the error: vlines() missing 1 required positional argument: 'ymax'
However, I cannot know the ymax ...
0
votes
1answer
28 views
How to inherit matplotlib in python?
When I run the program below:
import matplotlib
class abc(matplotlib):
def anything(self):
print("anything")
aa=abc()
I got the following errors:
File "test.py", line 2, in
...
0
votes
1answer
13 views
Matplotlib backend GTK3 Agg using Cairo?
I don't understand why while I' trying to use the Gtk3Agg backend and I end up with an error telling me the cairo module is not found.
** (simple_plot_in_gtk3.py:312517): WARNING **: Error ...
0
votes
1answer
31 views
python randomwalk not walking
my professor has given me this code and the only part im suppose to do is the TODO area. i am rather new to python still and have never touched on this type of project so i am rather confused. all ...
2
votes
4answers
24 views
Matplotlib: Boxplot outlier color change if keyword sym is used
I have the strange effect, that the color of the outlier changes, if i change the symbol used to draw them. (Documentation for Boxplot) Seems to me like a bug.
How can i 'reset' the colour to blue ...
-1
votes
3answers
38 views
How to draw circle by data with matplotlib + python?
I can draw a circle by scatter, which has been shown in the image. But I want to draw them buy a line, because there are many circles in total, I need to link nodes together for a certain circle. ...
1
vote
0answers
30 views
Error when tryting to use matplotlib
I'm just trying to plot a basic line chart with matplotlib of python. But I'm getting continuous errors and fixing one by one but stuck this time. I'm using Python 2.7 and below is the code I'm trying ...
5
votes
1answer
39 views
Box Plot Trellis
Consider I have some data.
Lets say it is weather data, of rainfall and temperature for each month.
For this example, I will randomly generate is like so:
def rand_weather(n):
month = n%12+1
...
0
votes
1answer
13 views
Change default colorbar for 3D scatter plot with matplotlib
I have 3d coordinates defining positions of points in my 3D scatter plot with a corresponding number of values who I want to create a colour scale for representing the range of values as such:
from ...
0
votes
0answers
19 views
Display mpld3 chart in HTML with django
I'm using mpld3 to display matplotlib charts inside an HTML page via django. I use mpld3.fig_to_dict method to produce a string from a matplotlib figure and save it in a JSON variable .
I don't know ...
0
votes
0answers
23 views
How can I increase the frequency of xticks/ labels for dates on a bar plot?
I am trying to increase the xtick and label frequency of dates on a barplot. It currently puts labels for every 2nd month, and I'd like to increase this to every month.
The code I have so far is:
...
1
vote
0answers
18 views
Read coordinates from mouse click in mpld3
I generated a figure using mpld3 and linked it to plugins.MousePosition() to display the coordinates, as below.
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import mpld3
from ...
0
votes
1answer
7 views
Calling plt.table for a matrix but getting weird plot
I have a matrix that I want to output the information in a plot and not with a color diagram like imshow does.
I have the following code:
...
0
votes
2answers
21 views
label manipulation for 3d plot using matplotlib
I came up with the following code to produce a figure in python+matplotlib:
fig = plt.figure(figsize=(10,8))
ax = fig.add_subplot(1,1,1, projection='3d')
ax.plot_surface(KX[kxl3d:kxr3d,kxl3d:kxr3d], ...
0
votes
0answers
29 views
External matplotlib viewer
Whenever I try to display a plot using the ipython notebook with the module matplotlib no plotting is shown (I was expecting the familiar external viewer), instead I have to use the magic command ...
1
vote
1answer
13 views
bbox_to_anchor and loc in matplotlib
I have come across matplotlib code which customizes legend loccation using keywords "loc" and "bbox_to_anchor". For example :
fig.legend([line1, line2], ['series1', 'series2'], bbox_to_anchor=[0.5, ...
0
votes
2answers
26 views
Python networkx graph appears jumbled when drawn in matplotlib
I am testing out how to create network graphs on "networkx"; my problem is that when I try plotting these graphs using "matplotlib", the nodes, edges, and labels appear jumbled. I want to have the ...
2
votes
1answer
20 views
Using matplotlib for Gaussian
so I am trying to plot a histogram of my data and I seem to be a little confused here. I am using matplotlib in python. Here is the code from their website:
mu = 100 #mean
sigma = 15 #std deviation
...
0
votes
0answers
22 views
Matplotlib hist 'stepfilled' cause y axis limits wrong when sharey in subplots
Is this a bug?
x = np.array([ 818711.1744542 , 669773.03634965, 543356.09981887,
470591.70414664, 714122.36408414, 217738.75076945,
28745.17458754, 141449.75133332, ...
1
vote
1answer
16 views
Matplotlib: Change the locator of an appended axis
I have a number of data images like the one below, in which I appended a new set of axes to the right to force the colorbar to be the same size as the image.
The ticks on the colorbar are too close ...
0
votes
1answer
24 views
Normalization of several time-series of different lengths and scale
Say I have several random time-series in numpy, e.g.:
my_time_series = dict()
for L in range(20,50,10):
scaling = np.random.randint(100)
my_time_series[L] = scaling * np.random.rand(L) + ...
2
votes
1answer
33 views
2D Heat Map using matplot lib
I'm new to python please so bear with me:
I'v been tryin to plot a 2D Heat-Map, similar to the one shown here:
http://mips.helmholtz-muenchen.de/plant/static/images/A_thal_LTRs.png
using the ...
0
votes
1answer
27 views
Getting y value of a curve given an x value
Given a Line2D object, which is the output of pyplot's plot function, I wish to determine the y coordinate of a given x. For example, if
import numpy as np
import matplotlib.pyplot as plt
x = ...
0
votes
0answers
21 views
Plot graphs in a loop from Pandas Groupby object
i'm quite new in pandas and i'm looking for a solution to plot several graphs with several series in a loop from a Groupby object.
below is the Groupby object
gp_df = ...
0
votes
1answer
22 views
Installing Canopy broke Matplotlib (ImportError: no module named matplotlib) [duplicate]
Ever since I installed canopy, my anaconda version of matplotlib has been broken. I cannot even import it in the command line. I have uninstalled canopy but still have not found success.
>>> ...
0
votes
1answer
9 views
Determine button clicked subplot in matplotlib
Given a figure with multiple plots, is there a way to determine which of them was clicked with a mouse button?
E.g.
fig = plt.figure()
ax = fig.add_subplot(121)
ax.imshow(imsp0)
ax = ...
0
votes
1answer
32 views
Given a list of items each associated with a color, how can I depict such a coloring?
So I'm working with a function in NetworkX that partitions a graph's vertices into blocks which receive colors (in (0, 1) ) which are then used to color the nodes of the graph(which correspond to ...