Tagged Questions
0
votes
1answer
14 views
Chnage color of histogram after it was plotted
How can I change the color of an Histogram after I draw it? (using hist)
z = hist([1,2,3])
z.set_color(???) < -- Something like this
also how can I check what color is the histogram
z = ...
0
votes
1answer
33 views
2D plot with matplotlib
I have just started using python and tried writing my small program for making simple 2d plots. I am trying to plot 2D matrix (60x60). It all works fine except for the extra element at (x=28,y=60) ...
0
votes
1answer
22 views
Seaborn implot with equation and R2 text
In my regular data analysis work, I have switched to use 100% python since the seaborn package becomes available. Big thanks to this wonderful package.
However, One excel-chart feature I miss is to ...
0
votes
1answer
29 views
contour plot with python loop and matplotlib
I can't figure out what's preventing me from getting a contour plot of this cost function. After much trial and error, I'm getting:
ValueError: zero-size array to reduction operation minimum which ...
0
votes
1answer
13 views
How to Zoom with Axes3D in Matplotlib
I am generating a 3D plot using matplotlib. I want to be able to zoom in on areas of interest. Currently, I am able to pan but not zoom. Looking at the mplot3d API, I learned about can_pan():
...
0
votes
2answers
42 views
Plot 3D probability distribution with matplotlib
I have a 1024x1024x1024 matrix which resembles a 3D-space each cell corresponds to a point in space. Each element of this matrix has a value determines the probability of the presence of the particle ...
-1
votes
1answer
21 views
Data file plot and over plot using AxesGrid toolkit
I have a data file, which is something like:
X Y Density
0 0 2.366
0 1 3.365
1 0 6.325
1 1 36.65
I'd like to read this kind of data and also plot it by using matplotlib ...
0
votes
1answer
24 views
typeerror in basic example for legend handles in matplotlib
I have difficulties to understand the legend handling. The more, the basic example from the official matplotlib legend guide
import matplotlib.pyplot as plt
line_up, = plt.plot([1,2,3], label='Line ...
0
votes
0answers
23 views
Regridding regular netcdf data
I have a netcdf file containing global sea-surface temperatures. Using matplotlib and Basemap, I've managed to make a map of this data, with the following code:
from netCDF4 import Dataset
import ...
0
votes
1answer
8 views
Remove or adapt border of frame of legend using matplotlib
When plotting a plot using matplotlib:
How to remove the box of the legend?
How to change the color of the border of the legend box?
How to remove only the border of the box of the legend?
0
votes
1answer
15 views
Set the color of the ticker powerlimits using matplotlib
I used the following code to set the power label on the y-axis of my plot to be [1e-3]. (Meaning that all my y-tick values are multiplied by 1e-3).
ax1 = plt.gca()
y_formatter = ...
3
votes
1answer
40 views
Multiple histograms in Pandas
I would like to create the following histogram (see image below) taken from the book "Think Stats". However, I cannot get them on the same plot. Each DataFrame takes its own subplot.
I have the ...
0
votes
1answer
17 views
Change tick frequency on X (time, not number) frequency in matplotlib
My python plot data only show 2 points on x axis.
I would like to have more, but don't know how.
x = [ datetime.datetime(1900,1,1,0,1,2),
datetime.datetime(1900,1,1,0,1,3),
...
] ...
0
votes
0answers
16 views
Python animate contour plot for function generated in for loops
I have a three-variable function myfunc that is generated inside three for loops. I want to draw a contour plot of y vs x and animate this for different times t. However, I've looked at the various ...
0
votes
1answer
19 views
Using matplotlib.animation inside a function in Canopy [duplicate]
The following script produces a simple animation of a traveling sine wave when executed using the %run statement in Canopy 1.4.1:
import numpy as np
from matplotlib import pyplot as plt
from ...
1
vote
1answer
12 views
Animating contourf plot
I am trying to animate a contour plot. The following example is close enough to what I want to achieve (from this archive):
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 2 * ...
2
votes
1answer
27 views
Matplotlib scale y axis based on manually zoomed x axis
I have a lot of data that is correlated on the x axis but are all center around very different Y values. The data is also very long on the x so its hard to see details. I want to be able to set the x ...
0
votes
0answers
24 views
how to generate a graph of the top requesters with matplotlib [on hold]
I have a bunch of data I need to graph, it is essentially an http log that contains the following:
date requester bytes
I would like to graph this in a way that I get to see the top requesters per ...
2
votes
1answer
29 views
Error when trying to save postscript with matplotlib Latex
When I try to save a python figure as PostScript ,When using Latex and the xfrac package, I am getting an error, I can save the figure in other formats, but not in PostScript
This is the code that I ...
0
votes
1answer
19 views
streamplot does not work with matplotlib basemap
I am trying to use streamplot function to plot wind field with basemap, projection "ortho". My test code is mainly based on this example:
Plotting wind vectors and wind barbs
Here is my code:
import ...
-1
votes
3answers
38 views
Plotting three data sets on a single plot using matplotlib
I am still getting my feet with python, so apologies if this is a very simple question.
I have an output file which contains 5 columns, as follows:
Depth Data#1 Data#2 Data#3 Standard_deviation
...
1
vote
2answers
16 views
Store mouse click event coordinates with matplotlib
I am trying to implement a simple mouse click event in matplotlib. I wish to plot a figure then use the mouse to select the lower and upper limits for integration.
So far I am able to print the ...
1
vote
1answer
33 views
Non-overlapping scatter plot labels using matplotlib
I have a scatter plot with a number of points. Each point has a string associated with it (varying in length) that I'd like to supply a label, but I can't fit them all. So I'd like to iterating ...
0
votes
1answer
25 views
matplotlib plot creation very slow on a headless server
I'm running Ubuntu 14.04 (server edition) on my home server and I have Python 2.7.6 installed with matplotlib 1.3.1 using TkAgg as the backend. I'm connecting to it via ssh -Y.
The problem I'm ...
0
votes
1answer
12 views
Matplotlib multiline axis text with different font size
How can I change the font size within the same matplotlib's y axis text. In the code below how put the unit (i.e., m4 kg-1 s-1) in smaller font below the name of the variable (i.e., Resistance)?
...
0
votes
1answer
15 views
Python Matplotlib: Remove black background when rasterizing part of plot in EPS?
This question is related to a comment on another question.
In matplotlib/python, I am trying to rasterize a specific element in my image and save it to eps. The issue is that when saving to EPS (but ...
0
votes
1answer
36 views
Python - plotting list of lists versus an other list
So, I have a list of stations (string) like this :
station_list=[station1, station2, station3, ..., station63]
And I have a list of lists with the measures of each stations, but they haven't the ...
0
votes
1answer
37 views
Python Matplotlib add Colorbar
i've got a problem using MatlobLib with "Custom" Shapes from a shapereader. Importing and viewing inserted faces works fine, but i'm not able to place a colorbar on my figure.
I already tried several ...
-5
votes
0answers
23 views
Plotting cluster using Matplotlib
![clusters network]: http://www.graphviz.org/Gallery/directed/cluster.png
I am looking to plot similar kind of network using python, matplotlib or NetworkX only.
0
votes
1answer
20 views
matplotlib bwr-colormap, always centered on zero
I am trying to plot a matrix with positive and negative numbers. The numbers will be in an interval from -1 to 1 but not at the complete range. Numbers could sometimes be in the range from -0.2 to ...
3
votes
1answer
19 views
Adding y=x to a matplotlib scatter plot if I haven't kept track of all the data points that went in
Here's some code that does scatter plot of a number of different series using matplotlib and then adds the line y=x:
import numpy as np, matplotlib.pyplot as plt, matplotlib.cm as cm, pylab
nseries ...
1
vote
2answers
53 views
Best way to plot a 3D matrix in python
I am trying to visualize 3D data. This is a full 3D matrix: each (x,y,z) coordinate has a value, unlike a surface or a collection of individual data vectors. The way I am trying to do this is to plot ...
0
votes
1answer
24 views
Plotting with multiple Y-axes
When using ax.<plot_function> for plotting objects on a figure. How can I "hold on" the plot and
render multiple plots on the same plot?
For example:
f = plt.figure(figsize=(13,6))
ax = ...
0
votes
0answers
16 views
Matplotlib Plot animation with events [closed]
I would like to create a Matplotlib animated Plot that changes based on events. The plot should be animated as fastest as possible.
I was thinking about creating a class MyLinePlot() containing the ...
0
votes
0answers
17 views
error in saving file in jpg format using imagemagick and imagemagick_file in matplotlib
I have to save animated jpg file using only imagemagick or imagemagick_file writer in matplotlib.
I have used below code:
ani = matplotlib.animation.FuncAnimation(fig, animate, ...
0
votes
1answer
18 views
barplot with N distinct colors shade in matplotlib
I have a bar chart of N bars I built with python matplotlib.pyplot.bar and I would like to give each bar a different color following a shaded off:
for example if N = 4, I would like: yellow, orange, ...
1
vote
2answers
28 views
Multivalued Histogram as combined scatter and histogram plot
I have some theoretical calculations for something in my research. I want to represent the accuracy of this data by taking the theoretical values and subtracting them from the experimental values. ...
0
votes
0answers
23 views
Why are my figures not updated after plotting with matplotlib?
I have written a few simple classes for creating standard figures I often use. It's a baseclass that uses a gridspec object for defining subplots. From that, I derive other classes for special cases ...
2
votes
1answer
9 views
Remove errorbars and lines from figure
I would like to save three plots to a file. In the first file all three plots should be contained, in the second only two and in the third one only one plot.
My idea would be the following:
import ...
1
vote
0answers
20 views
Matplotlib event handling and Cython
I'm trying to connect a matplotlib event string to a function using mpl_connect(s, func) as in the following code:
import matplotlib.pyplot as plt
fig = plt.figure()
def onrelease(mouseEvent):
...
0
votes
1answer
20 views
How to add legend to imshow() in matplotlib
I am using matplotlib
In plot() or bar(), we can easily put legend, if we add labels to them. but what if it is a contourf() or imshow()
I know there is a colorbar() which can present the color ...
0
votes
1answer
31 views
Python plotting contour of function generated in for loop
I want to do a contour plot for a function z (its values are in zlist), where the axes show the parameters x and y. The z is produced inside two for loops where I specify different x and y. I get an ...
0
votes
0answers
25 views
How to add appropriate legend when plotting a bar chart using groupby and DataFrame.plot() in pandas?
I'm trying to plot a bar chart of sensor data using pandas groupby in Python with an appropriate legend. I am using a DataFrame that has been constructed from a CSV file (CSV file available here: ...
1
vote
1answer
24 views
Plotting non-square array with contour
I am trying to make a projected 3D plot (contour plot) of a big array with matplotlib and it turned out like this:
I reckon it has something to do with defining the x and y axis. The code I have ...
1
vote
1answer
27 views
Plotting on a BaseMap - unexpected result
I am running the following code, which should be basic basemap stuff:
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
#basic stuff from the examples
...
1
vote
1answer
27 views
Matplot: How to plot true/false or active/deactive data?
I want to plot a true/false or active/deactive binary data similar to the following picture:
The horizontal axis is time and the vertical axis is some entities(Here some sensors) which is ...
-2
votes
1answer
30 views
Best and current tools and programming languages to use in building a web site that does engineering calculations and graph outputs [closed]
I have written a Python application that takes about 4 numbers from the user and does some calculations with it. The final result is displayed on a matplotlib graph. Now, I would like to take this ...
0
votes
1answer
28 views
Using Anaconda Python with PyQt5
I have an existing PyQt5/Python3.4 application that works great, and would now like to add "real-time" data graphing to it. Since matplotlib installation specifically looks for Python 3.2, and NumPhy ...
0
votes
1answer
17 views
Making the axis bigger or autoadjust to allow more ticks in matplotlib
Is there a way to that the figure in matplotlib can auto adjust the axis to accomodate more ticks
ticks = [0.5, 5.5, 10.5, 15.5, 20.5, 25.5, 29.5, 31.5, 36.5, 41.5, 46.5, 51.5, 56.5, 60, 65, 70]
...
1
vote
0answers
26 views
how to speed up imshow matplotlib?
I am trying to plot this vector in real time on my raspberry pi.
the fastest I have managed to complete a loop was 0.6 seconds.
is there a way to speed things up?
import numpy as np
import time
...