Tagged Questions
3
votes
1answer
28 views
Extract columns using “genfromtxt”
I've already read these 2 questions before asking this one (q1 and q2) but I haven't found any satisfying answer
I need to extract two columns from a 2D-array without using pandas or loadtxt, but ...
1
vote
0answers
13 views
Threading matplotlib for multiple subplots
I am never used the threading and would like to know if it is possible to thread plots for matplotlib. When you have a large dataset for matplotlib it becomes very slow to generate graphs. I tried ...
1
vote
1answer
17 views
Add a legend in a 3D scatterplot with scatter() in Matplotlib
I want to create a 3D scatterplot with different datasets in the same plot and a legend with their labels. The problem I am facing is that I cannot properly add the legend and I get a plot with an ...
0
votes
1answer
26 views
Setting linewidth of Pandas boxplot fliers
As always, I'm amazed by the richness of Pandas's features, as I discover DataFrame.boxplot.
But I'd like to be able to manipulate the resulting plot in arbitrary ways (examples include setting the ...
1
vote
1answer
32 views
How to draw arrows and arcs in a contour plot using Python matplotlib
I have made a contour plot like that using Python Matplot lib
I would like to know how can I add arrows like those white ones, and something like this little arc on bellow the angle theta (to show ...
2
votes
3answers
71 views
How to fit to a log scale [duplicate]
I have the following points
0 4194304
1 497420
2 76230
3 17220
4 3595
5 1697
6 491
7 184
8 54
9 15
10 4
11 4
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
21 1
If I plot them with a log scale on the ...
0
votes
1answer
28 views
Plot GDAL raster using matplotlib Basemap
I would like to plot a raster tiff (download-723Kb) using matplotlib Basemap. My raster's projection coordinates is in meter:
In [2]:
path = r'albers_5km.tif'
raster = gdal.Open(path, ...
0
votes
0answers
31 views
Error for plotting graph in python
Here i have piece of code that plot graph time vs elevation and conv elevation. i downloaded the matplot from below link and in module i found it doesn't detect pyplot.Also let me know how to use ...
0
votes
0answers
22 views
A text only PDF page using matplotlib
I am generating a multi-page PDF with different graphs in each page using matplotlib. I would like to add another page that contains some information relevant to these graphs. But all text addition ...
2
votes
1answer
8 views
matplotlib PdfPages - storing a lossy copy of a plot with lots of data
I'm creating plots with matplotlib.pyplot and writing them to pdf. Some of these plots have largeish (up to 100,000) points and obviously have a lot of overlapping points, i.e. certain parts of the ...
2
votes
1answer
48 views
“import matplotlib.pyplot as plt” in ipython notebook
I'm new to ipython notebook, but I have the following error message whenever I run import matplotlib.pyplot as plt. I'm using Mac. It works fine with the built-in python or Canopy. The problem only ...
0
votes
0answers
27 views
How to add shapes in python graph
I am using matplotlib to get a graph like that:
More or less like that, not so similar saying the truth, the point is, I do need to add a shape like those semicircles (arrows) that they are showing ...
1
vote
1answer
23 views
Matplotlib axvspan shading for pandas DataFrame subplots based on one of the columns
What is the most elegant way to shade a pandas subplots based on one of the columns in a DataFrame?
A simple example:
In [8]:
from random import *
import pandas as pd
randBinList = lambda n: ...
2
votes
1answer
27 views
Unexpected Interpolation when using LinearSegmentedColormap
I am trying to create a custom color map which combines interpolated and discretized color segments. I am hoping that matplotlib's LinearSegmentedColormap can provide such functionality. My test case ...
0
votes
2answers
20 views
python - error while using matplotlib.pyplot.scatter function for the first time
I just wanted to get started on using the matplotlib library for the first time.
So I type the following commands:
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
data = ...
0
votes
2answers
28 views
using pyplot subplots with pandas lag_plot
I'm trying to make a figure with multiple subplots using the lag_plot module of pandas (Lag-1 correlation plots). I'm trying this with the standard 'subplots' command of pyplot, but it doesn't seem to ...
0
votes
1answer
17 views
Python: Keep savefig from overwriting old plots
I simply use
plt.savefig(filename+'.png', format='png')
to save my plots. But I want to keep my old versions of filename.png when I create a new one (using different colour codes, etc.) without ...
1
vote
1answer
21 views
How to place minor ticks on symlog scale?
I use the symlog scale of matplotlib to cover a large ranges of parameters extending both into positive and negative direction. Unfortunately, the symlog-scale is not very intuitive and probably also ...
2
votes
0answers
20 views
Pylab clip bargraph ends
I am trying to clip the ends of the the bars in a bar graph like this.
Can I use the clip_box or clip_path options of a matplotlib.pyplot.bar?
If so can someone please explain how they work? Where ...
0
votes
1answer
33 views
How can I create a single x axis label and y axis label for mutiple subplots?
I have this code:
pyplot.figure()
pyplot.suptitle('Finding the roots of the equation: z^4 - 1 = 0')
ticks = [-2.0, -1.0, 0.0, 1.0, 2.0]
pyplot.subplot(221)
pyplot.imshow(roots, extent=(x0, x1, y0, ...
0
votes
1answer
33 views
How to change the colours of a contour plot
I am using this code below to create a contour plot, and it is okay, very succeed, but I cannot change the colors, do someone knows how to do that?
import numpy as np
import matplotlib.pyplot as plt
...
0
votes
0answers
34 views
matplotlib showing empty plot in Python
I am using Python 2.7 and matplotlib to create a simple plot window on Ubuntu 12.10.
When plt.plot() is called, an empty windows comes up, but closes instantaneously, without displaying any figure ...
1
vote
1answer
20 views
Contour plot in Python importing txt table file
I am trying to make a contour plot like:
Using a table of data like 3 columns in a txt file, with a long number of lines.
Using this code:
import numpy as np
import matplotlib.pyplot as plt
...
0
votes
0answers
20 views
Failed to make contiguous array of PyArray_DOUBLE
I am trying to create a plot and update it with new data like this:
def createPlot(self,vector):
child = MyForm(self)
child.plot = CurvePlot( self )
ly = ...
0
votes
2answers
33 views
How can I plot this data?
I am trying to plot this data. I know it should be quite easy to do that but I am struggling (haven't had my coffee yet).
h = 1
m = 1
E1 = (((h**2)/(2*m)) * ((((1*np.pi)/2)+((1*np.pi)/2))**2))
E2 = ...
1
vote
1answer
24 views
python rotate values on xaxis to not overlap
I'm having some problems with the xticks of the graph here:
Can anyone help?
I tried what they did here: Date ticks and rotation in matplotlib but to no avail.
import numpy as np
from ...
2
votes
2answers
44 views
How can i transform Image1 to Image2 using matplotlib.pyplot or another library in python
How can i transform Image1 to Image2 using matplotlib.pyplot or another library in Python?
Image 1:
Image 2:
Any help is appreciated.
1
vote
1answer
25 views
How to remove gaps between bars in Matplotlib bar chart
I'm making a bar chart in Matplotlib with a call like this:
xs.bar(bar_lefts, bar_heights, facecolor='black', edgecolor='black')
I get a barchart that looks like this:
What I'd like is one with ...
2
votes
2answers
30 views
Python Use data/time as x-axis?
I'm playing around with my raspberry pi sensors and trying to make a decent plot of the readings.
Now I am savind all the data into a google docs: ...
0
votes
0answers
12 views
Matplotlib triangulation stops working on switching coordinates
I get the following weird error when I switch x and y coordinates on a set of points
File "min_working_example.py", line 8, in <module>
triang = ...
0
votes
1answer
25 views
Create loglog plot of histogram data in xy style - python matplotlib
I have a list of values (integers) and I want to show on a graph how many times each value in it occurs.
I have created a dictionary of values and corresponding frequencies from the list as after ...
0
votes
2answers
11 views
calling colours in python pylab
So when I use pyplot I know how to use the colours blue and red dots, 'bo' and 'ro' respectively. However I cannot find the respective colour codes for orange, yellow, green, indigo and violet (Yup ...
1
vote
1answer
33 views
Python Pandas plotting title name passing string
How do I make the title name display 'AAPL Stock Price' without converting all my pandas data to matplotlib and numpy.
import time
from pylab import *
import pandas as pd
import numpy as np
import ...
1
vote
1answer
25 views
Reversing colormaps or specifying colors in a matplotlib/pandas plot
I am following some examples from the book Python for Data Analysis, and came across an interesting problem. I was wondering if there is a way to "reverse" of a colormap, for example from a blue ...
2
votes
1answer
32 views
Flask matplotlib graphics in template
I have a pretty beginner-question. Is it possible to display dynamically processed matplotlib images (as shown in https://gist.github.com/wilsaj/862153 or https://gist.github.com/rduplain/1641344) ...
1
vote
2answers
45 views
Basic Matplotlib Scatter Plot From Pandas DataFrame
How to make a basic scatter plot of column in a DataFrame vs the index of that DataFrame? Im using python 2.7.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
...
0
votes
1answer
27 views
Connecting two sankey diagrams in matplotlib
I'm trying to represent a country's gas balance using matplotlib.
The idea is that there are three sources of imported gas which I want to plot using one sankey and connect it to another sankey which ...
0
votes
0answers
18 views
Matplotlib in a Client Server Architecture
My application has a Client server architecture.
Server handles data processing on an homebrew cluster.
client (wxpython) connects to the server over a network (10 GB, 1GB network) and plots the ...
0
votes
1answer
22 views
Remove the x-axis ticks while keeping the grids (matplotlib) [duplicate]
I want to remove the ticks on the x-axis but keep the vertical girds. When I do the following I lose both x-axis ticks as well as the grid.
import matplotlib.pyplot as plt
fig = plt.figure()
figr = ...
0
votes
1answer
25 views
matplotlib fails to output EPS figure with usetex = True
I am trying to output (savefig) matplotlib figures as EPS; however, it seems there is a conflict when using the LaTeX rendering AND saving EPS figures. For example, the following code produces a good ...
0
votes
1answer
23 views
matplotlib not displaying intersection of 3D planes correctly
I want to plot two planes and find their intersection line, but I get this result, where it's impossible to tell where they intersect, because one plane overlays the other.
A 3D projection should ...
1
vote
0answers
37 views
IPython Interactive Matplotlib Widgets Remote Server?
I am running an ipython server (for the notebook) on a remote linux machine. I have setup a profile that listens on the remote machine such that I can access locally using:
https://myserver:9999
...
0
votes
1answer
31 views
matplotlib close does not close the window
I have noticed that when I run:
import pylab as pl
pl.ion()
# Plot something
pl.show()
pl.close()
The last statement does not fully close the Figure. The figure goes dark, and the contents go away, ...
0
votes
1answer
44 views
How to get smooth filled contour in matplotlib?
Hi iam trying to plot a filled contour of uneven data. which is in a three lists. My problem here is i can't able to get smooth filled contour. what i did is first i changed my data from a irregular ...
3
votes
2answers
116 views
+50
Annotating an annotation with Matplotlib
I am currently doing some "fancy" annotation in Matplotlib:
import matplotlib.pyplot as plt
ax = plt.subplot(111)
plt.axis('equal')
src_pos, dst_pos = (0, 0), (1, 1)
src_patch = ...
1
vote
0answers
53 views
matplotlib generated PDF cannot be viewed in acrobat reader
I am plotting data with matplotlib including LaTeX fonts. The pdf created can be displayed by evince, inkscape, GIMP but not by acroread resp. adobe reader. The code prototype works with a lot of ...
1
vote
1answer
48 views
Adding one polygon to a plot using matplotlib-basemap
I have the following code:
from mpl_toolkits.basemap import Basemap
map = Basemap(projection='merc', lat_0=50, lon_0=4,
resolution = 'l', area_thresh = 0.1,
llcrnrlon=4, llcrnrlat=50,
...
-2
votes
1answer
985 views
Using matplotlib how could I plot a histogram with given data in python
here is the data:
111, 3
122, 4
155, 3
192, 5
11, 9
123, 10
120, 23
now how could I able to plot a histogram using this two set of data in matplotlib.
please help.
11
votes
2answers
7k views
plotting 3d scatter in matplotlib
I have a collection of Nx3 matrices in scipy/numpy and I'd like to make a 3 dimensional scatter of it, where the X and Y axes are determined by the values of first and second columns of the matrix, ...
26
votes
3answers
7k views
Invert colormap in matplotlib
I would like to know how to simply reverse the color order of a given colormap in order to use it with plot_surface.