Tagged Questions
0
votes
0answers
10 views
Matplotlib: remove “offsets” to figure ticks
Is there a setting to make matplotlib never use the circled adjustments?
Preferably something that doesn't need to be done for every figure.
0
votes
0answers
12 views
Matplotlib produces to small figures
I am having some troubles with matplotlib producing to small figures. I have extracted the right textwidth from my latex document, using \the\textwidth and inseted it in my script. I'am using the Koma ...
0
votes
0answers
6 views
Ranged Colormap with matplotlib
How do I go about creating a colormap which will give me colors over a certain input value range?
For example, if I create an array like so:
my_input = np.arange(-10, 10)
And this new colormap:
...
-1
votes
0answers
13 views
How to limit NaN filling in pandas dataframe
I have three pandas dataframe that containing three type of index 15 minutes period, 1 minutes and 15 seconds, I added NaNs to dataframes as it comes follow, and plotted theme in same figure.
Graph:
...
0
votes
0answers
13 views
Why matplotlib Slider not interactive?
I imitate the slider_demo.py example, and write a piece of code to draw vector field. But the sliders don't work. The second slider is not interactive, which doesn't respond to mouse event.
The code ...
0
votes
0answers
28 views
Plot 4d dimensional
I have a 4d or higher ellipsoid in matrix form (which form is important). I wish to plot 3d dimensional plots (The projection on 3d hyperplane). Of the 4/5/6 dimensions I am projecting from, I want to ...
0
votes
1answer
15 views
Save figure with clip box from another figure
Normally if you plot two different figures using the default settings in pyplot, they will be exactly the same size, and if saved can be neatly aligned in PowerPoint or the like. I'd like to generate ...
1
vote
1answer
25 views
Place text label in 3D coordinates that are not data-dependent
I have a subplot containing 2x2 3-D graphs. In this graph I want to place a text box, to put some additional information.
To this end, I've found the matplotlib.pyplot.text function.
However, this ...
0
votes
1answer
22 views
Getting an error when trying to import matplotlib
I am using ipython when I am trying to import matplotlib.
I am getting following error
ImportError Traceback (most recent call last)
...
0
votes
0answers
25 views
Python - Fetching open, high, low, close prices from raw bitcoincharts api's csv
I've been trying to process the data from http://api.bitcoincharts.com/v1/ to make a 5-min candlestick chart using candlestick_ohlc function of matplotlib.finance.
The raw data looks like this:
...
1
vote
1answer
10 views
Interactive matplotlib/ipython figures on Windows
I'm having trouble getting matplotlib up and running on a recent Win7/Cygwin installation.
I've use the Cygwin package manager to install python 2.7.8, but the mirrors I have tried don't seem to ...
0
votes
0answers
19 views
Installing Matplotlib on CentOS 6.5
I'm trying to get matplotlib-1.4.0 installed on CentOS 6.5 with Python 2.7.8. I've tried installing with pip and from source. I initially got an error message stating I needed a newer version of ...
0
votes
1answer
23 views
Python finding time to return to equilibrium in SHM
I have a model y which models the motion of simple harmonic motion (SHM) of say, a pendulum. I want to be able to find the time t in which the pendulum returns to its rest position (at y=d) after it ...
0
votes
1answer
19 views
Python: Plotting strings on x axis of matplot scatterplot yields “could not convert string to float”
I have a dictionary aggregate_dict that has letters a:z as keys, with each key having a list containing exactly 11 numerical values between 0 and 1 as its associated value. I wish to use this data to ...
1
vote
1answer
26 views
Align legend rows in matplotlib
I am doing a plot with matplotlib and creating a legend for this (see code below). I want the legends rows be aligned horizontally such that the relations > and < are aligned. Trying to adapt ...
0
votes
0answers
11 views
Installing matplotlib via pip on Ubuntu 12.04
I'm trying to use matplotlib on Ubuntu 12.04. So I built a wheel with pip:
python .local/bin/pip wheel --wheel-dir=wheel/ --build=build/ matplotlib
Then successfully installed it:
python ...
0
votes
1answer
18 views
Matplotlib : What is the function of cmap in imshow?
I'm trying to learn opencv using python and came across this code below:
import cv2
import numpy as np
from matplotlib import pyplot as plt
BLUE = [255,0,0]
img1 = cv2.imread('opencv_logo.png')
...
-3
votes
0answers
58 views
Differences between Bokeh and Plotly [on hold]
I have been following the development around Bokeh and Plotly for some time now. What distinguishes these libraries in terms of features/scope? Can both libraries be used for building apps with ...
0
votes
0answers
10 views
defining a partial geostationary projection with matplotlib Basemap
i'm having trouble creating a custom geostationary projection with Basemap. what i'd need is not a full globe projection, but the upper third of a full disc (full width, one third from the top down ). ...
0
votes
1answer
9 views
Misplacement of the ticks on the secondary x-axis in pyplot
I am trying to plot a time series with labels corresponding to GMT time at the bottom and local time (GMT-7) at the top between Julian Days 128 and 158. I am using twiny() to create the secondary ...
1
vote
2answers
25 views
pyplot legend not matching lines
My legend doesn't match the line colors. Any idea how I go about fixing this and what I am doing wrong? The code downloads the data from yahoo finance so you should be able to run it as is on your ...
0
votes
2answers
42 views
Convert a timestamp to date and plot() equivilant in matplotlib
I am having trouble creating a plot and also with converting a timestamp to a date.
The code below pulls data from yahoo finance into a pandas data frame. The date serves as the index for the ...
-3
votes
0answers
25 views
Interactive graph python [on hold]
Can anyone please help me? I have to make a program which takes data from external equipement, put into a .txt file and than make a interactive graph. I have something like this:
while i ...
0
votes
1answer
11 views
How to make sublime refer to the active Python
I downloaded python via macports and I am currently running code via Sublime Text 2.
When I run a code, for instance, the code has
import matplotlib
Sublime is giving me this error:
...
0
votes
1answer
18 views
fillplots module in Python
Does anybody know about module fillplots (http://fillplots.readthedocs.org)? I've successfully installed it but when I run some simple code from ...
0
votes
0answers
17 views
mpld3 : How to add custom x axis labels?
I would like to assign specific labels to the x axis when applying mpld3 plugin (http://mpld3.github.io/index.html).
This is my code
fig, _ = plt.subplots()
plt.hist(time_lags, bins=num_bins)
...
0
votes
1answer
33 views
How to add a circle to image (figure) in python 2.7?
I have this code in python 2.7 :
import numpy as np
from astropy.io import fits
import matplotlib.pyplot as plt
image_file='test.fits'
hdu_list = fits.open(image_file)
image_data = hdu_list[0].data
...
0
votes
1answer
17 views
CDF/PDF plot not showing
I am able to get a histogram from a Pandas dataframe to appear fine. I'd like to also show the PDf/CDF as line charts on the same plot.
My code:
import scipy.stats as stats
from scipy.stats import ...
0
votes
0answers
13 views
matplotlib: Applying an image as the background of a matplotlib wedge
I want to insert the image of a flag into the wedge of a pie chart in matplotlib. I tried to do it by modifying the each patch with the image of the flag through the Figure atribute, but it didn't ...
0
votes
0answers
28 views
How to increase the size of Pandas Scatter Matrix?
I am making a straightforward scatter matrix with Pandas in IPython Notebook. When I use more than a 4x4 matrix, my plots are scaled too small for my liking. How can I increase the size of the total ...
0
votes
1answer
187 views
can't install matplotlib using pip
I'm on Ubuntu 14.04, and have been trying to install matplotlib using pip. I'm using Python 2.7.6. However, whenever I run "sudo pip install matplotlib", I get the following errors:
...
0
votes
1answer
24 views
Redrawing legend when the figure is closed
Using matplotlib, I'm trying to execute a callback function when a figure is closed, which redraws the figure legend. However, when I call ax.legend(), it seems to block any further code being ...
0
votes
3answers
62 views
Men=mars and female=venus symbols in python
I wish to create a plot that uses venus (U+2640 ♀) symbol to represent females and mars (U+2642 ♂) symbol to represent males. If you have used these before, please share with me how to set them as ...
0
votes
1answer
10 views
Force matplotlib to use n ticks
I've tried
plt.locator_params(tight=False, axis = 'y', nbins = 4)
and
plt.gca().yaxis.set_major_locator( MaxNLocator(nbins = 4) )
but that only makes matplotlib use up to 4 ticks, not exactly ...
1
vote
1answer
22 views
Change color of histogram after it was plotted
How can I change the color of a 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
37 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
25 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
33 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
20 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
48 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
22 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 ...
1
vote
1answer
28 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
1answer
35 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
42 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
22 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 * ...