Tagged Questions
Matplotlib is a plotting library for Python which may be used interactively or embedded in stand-alone GUIs. Its compact "pyplot" interface is similar to the plotting functions of MATLAB®.
-4
votes
0answers
12 views
Process multiple user data using pandas
I have sensor readings stored as a csv file from different users with their respective time stamps. I want to process the data separately using pandas and plot the sensor readings of all the users in ...
0
votes
1answer
19 views
Incorrect square wave sampling using scipy
Trying to plot 2Hz square wave sampled at 4Hz (see attached figure below). Why am I not getting a uniformity for sample encircled red which should IMO be at -1 marked by 2nd red arrow:
Here is my ...
-2
votes
0answers
12 views
“Radial grids must be strictly positive” error on radar chart
Whilst plotting my complex radar chart, I am getting the error "radial grids must be strictly positive", but all of the values and ranges I have used in my radar chart are all positive. Can someone ...
0
votes
2answers
27 views
Error while plotting contour in Matplotlib
I have X coordinates ,Y coordinates and Zcoordinates, each stored in an array with n x 1 . (n rows,1 column) .The contour plot in Matplotlib allows to plot only if "*X and Y must both be 2-D with ...
1
vote
0answers
8 views
matplotlib how to adjust navigation and cursor display
When plotting two time series on two different y-scales using twinx:
ax1 = pp.subplot(111)
ax2 = ax1.twinx()
the default behavior for navigation seems to be:
zoom/pan will control both axes ...
0
votes
0answers
21 views
How to create a trendline for a scatter graph
I try to make a linear trendline (with a corresponding equation) with the following code, however, using what I have below creates a line that goes through each point, rather than creating a average. ...
-1
votes
1answer
25 views
ValueError: x and y must have the same first dimension
I am trying to implement a finite difference approximation to solve the Heat Equation, u_t = k * u_{xx}, in Python using NumPy.
Here is a copy of the code I am running:
## This program is to ...
0
votes
1answer
7 views
.annotate() is not plotting all labels
I've created a dataframe with stock information. When I go to create a scatter plot and annotate labels, not all of the labels are included. I'm only getting 3 labels out of 50 or so points. I can't ...
0
votes
0answers
32 views
Making 3D visualization in Python/Pandas interactive [on hold]
I'm looking for ways to make 3D scatter plots where I can hover over points to view their coordinates. I also want to use a column containing strings as axis labels, with equal spacing. How can I do ...
1
vote
0answers
9 views
AttributeError: 'FigureCanvasMac' object has no attribute 'restore_region' with matplotlib animation example on Mac OSX
Using the example code from matplotlib site:
I get the error:
AttributeError: 'FigureCanvasMac' object has no attribute 'restore_region'
spammed in the output as the animation loops. The animation ...
1
vote
1answer
21 views
Geopandas plots as subfigures
Say I have the following geodataframe that contains 3 polygon objects.
>>> import geopandas as gpd
>>> from shapely.geometry import Polygon
>>>
>>> p1=Polygon([(0,...
0
votes
1answer
31 views
error importing python matplotlib
I am attempting to import a matplotlib function (Mac OS 10.11.4) using Anaconda and python 3.4
I successfuly installed the latest matplotlib using conda install -c conda-forge matplotlib=1.5.2
And ...
0
votes
1answer
9 views
How to plot a hanging rootogram in python?
Inspired by this question, how do you make the same kind of plot in python? This plot aims at having a nice visual representation of how your distribution is off of the expected distribution. It hangs ...
0
votes
0answers
11 views
Adjust Contoured Data to Elevation/Terrain Grid
I have a CSV file that contains temperature data for select lat/lon points.
CSV File Example:
data,lat,lon
data,lat,lon
data,lat,lon
data,lat,lon
data,lat,lon
Data Output Example:
I am interested ...
2
votes
0answers
19 views
Matplotlib 3D with Multiple Axes
Setup and Background
I have two sets of data, a black set and a color set, each of which lives on a separate plane but has some prescribed relationship between the two. I generated the following plot ...
0
votes
1answer
18 views
How can I manage the location of the “NavigationToolbar2TkAgg” toolbar?
I'm learning how to use matplotlib, and now I have a problem. When I create a Figure in "tkinter project" and give it a subplot, I use NavigationToolbar2TkAgg to create a toolbar. This toolbar appears ...
1
vote
1answer
13 views
add a subplot to the plot produced by a previous function
I've written a function that reads data from a csv file and plots it. Now I need to add a subplot with another part of the data from the same file, so I've tried to write a function that calls the ...
1
vote
1answer
24 views
Finding largest closed 3D contour plot
I have a scatter plot and many contour plots. There are many contours,some closed some not. How can I identify the values of the largest closed contour from [this].1
0
votes
2answers
44 views
Converting timestamps from a csv to seconds using python
I have sensor data(acclerometer,compass) saved in a csv file with their time stamps hh-mm-ss format. I wanted to convert the time stamp into seconds to plot the compass reading at a particular second.
...
2
votes
0answers
16 views
How to Group Boxplots by Day in Dataframe
So I have data which looks like this:
Observed WRF
2014-06-28 12:00:00 0.000000 1.823554
2014-06-28 13:00:00 0.000000 1.001567
2014-06-28 14:00:00 0.000000 0.309840
...
1
vote
1answer
20 views
Given a function with widespread zero tails: Cut down the plotting range
I'd like to plot (using matplotlib.pyplot) a probability density function (pdf), but hide their left and/or right tail whenever these are fairly close to zero.
E.g., the normal distribution when ...
1
vote
0answers
14 views
Render plt.vlines(…) in plt.xkcd() mode as all other lines
As you can see from the image above a plt.vlines() is rendered as a straight line, while everyone desires a wobbling(?) line.
My code:
# usual imports
with plt.xkcd():
...
plt.vlines(t0, -0.04,...
1
vote
0answers
17 views
Embedded matplotlib figure in GUI: How to show the cursor position (x= , y= )?
I have embedded a matplotlib plot in my GUI like this:
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
fig = DataPlot()
self.canvas = FigureCanvas(fig)
self.vL_Frame....
0
votes
1answer
11 views
Drawing a FacetGrid of QQ-plots with seaborn
I am unable to draw a FacetGrid of QQ-plots with seaborn.
I have a matrix of m rows (observations) and n columns (features), and I want to draw a QQ-plot for each feature (column) to compare it with ...
3
votes
2answers
42 views
How to create a heat map in python that ranges from green to red?
I'm trying to plot log ratios from the range -3 to 3 and want negative ratios to be green and positive to be red, with a log ratio of 0 (center) to be white in color. None of the pre-existing color ...
0
votes
0answers
11 views
Contour data with cartopy
I am trying to plot some bathymetry data using cartopy. I slice out a section of the data and plot it over a Mercator projection. It produces a map that looks ok but I get the following error,
...
1
vote
0answers
20 views
Matplotlib Specgram logarithm y-scale axis is not functioning
Based off previous stack overflow questions, I know what needs to be done is plt.yscale('log', nonposy = 'clip')or ax.set_yscale('log') However, this is resulting in a blank/empty plot. There was also ...
1
vote
1answer
18 views
Python Basemap: Error using shadedrelief, bluemarble or etopo (false longitude format?)
I want to plot a map of the southern hemisphere centered on the pacific with some stuff drawn onto it with python matplotlib basemap.
Everything works fine unless I try to draw a background image ...
1
vote
1answer
20 views
How to animate a bar char being updated in Python
I want to create an animated, stacked bar chart.
There is a great tutorial, which shows how to animate line graphs.
However, for animating bar charts, the BarContainer object, does not have any ...
0
votes
1answer
38 views
How to determine coordinate of grid elements of an image
Given an image of with a known dimension (eg. 14782 x5495 pixels) and a desired square size (e.g. width,height = 696 pixels) size, how can I get the coordinates of each element in the grid?
In ...
-3
votes
0answers
24 views
New matplotlib colormaps are not eye-friendly when picking through cycle
Here is how I'm used to setting colors in a plot:
fig, ax = plt.subplots(1, 1)
cmap = plt.get_cmap('plasma')
color = iter(cmap(np.linspace(0, 1, 2)))
ax.plot(u, label='u', c=next(color))
ax.plot(...
-3
votes
0answers
41 views
Python : matplotlib plots using a while condition
I'd like to make a script where the user has to enter an integer into the console to plot the a list, as long as he likes. My original script is quite big, so here is a simpler version using a matrix :...
-4
votes
2answers
31 views
Python : How to shift the square plot in the x axis by a given value? [on hold]
X = [0.3, 0.7, 0, 0.8]
I want to plot like below. But using general plt.plot I cannot like below.
Here I miss a logic to implement this ?
1
vote
1answer
26 views
Latex not displayed correctly in matplotlib
When executing the following code in python using jupyter/ipython, the Latex symbols are not displayed correctly. Any Idea why this could be?
import matplotlib.pyplot as plt
import numpy as np
%...
-1
votes
0answers
10 views
Getting cv2 video and pyplot pcolormesh to show together
I am working on a project which requires to launch a video and the color map of certain sensory data at the same time where the color map is updated at a given pace (e.g., sampling rate). I am using ...
2
votes
1answer
41 views
matplot program gives unresponsive window when run
You'll notice that there is a bunch of missing code, it's for all the games being called from the menu. I removed it because it is long and not needed for my question. My issue is only with a ...
1
vote
0answers
18 views
How to convert scala dataframe to python data frame : Spark (Zeppelin) [duplicate]
I am trying to draw histogram for the spark data frame :
val df2 = sqlContext.jsonFile("s3://testData/test.gz")
df2.show()
val result1 = df2.withColumn("visited", explode($"visited"))....
2
votes
1answer
21 views
Indicate external value on matplotlib colorbar
I have a scatterplot that is coloured with respect to a third variable. I can create a colorbar for this plot, but would like to also indicate an external level (just with a horizontal line) on the ...
0
votes
2answers
22 views
matplotlib using text instead of number in y ticks
I want my y axis' tick is text label rather than number, and my x is a series of datetime object, I want a plot to represent a track of a man's event during a day, that's the scene.
This is my code :...
-2
votes
0answers
17 views
Matplotlib scrolling plot-How to apply?
I'm new to Python and I want to implement a scrolling plot for a very long time series data.
I've found documentation from Matplotlib as following.
http://scipy-cookbook.readthedocs.io/items/...
2
votes
1answer
20 views
Use Unicode Greek letters in Matplotlib
In MATLAB, if you type "\alpha" in an axis label it will render a 'plain-text' Greek character alpha, without the need for Latex. I hoping to do the same with Matplotlib's Pyplot.
Following How to ...
-1
votes
1answer
15 views
convert 2 arrays into a matrix in python
I have a coordinates file which I read into a matrix in python. I want to create a delauney triangulation and plot it with the coordinates joined together with lines. I have the following code which ...
1
vote
1answer
22 views
Using Index for scatter plot Legend
I've created a DataFrame with some stock information. When I try to use the index as the data labels it does not work. This makes it so I cannot differentiate the stocks, especially when I add more. ...
1
vote
0answers
31 views
Multiple histograms with logarithmic x scale
This is a combination of this thread on multiple histograms, and this thread on a logarithmic scales.
I am trying to have two (or more) histograms in a plot with a logarithmic x-scale, using this ...
0
votes
1answer
14 views
Pandas matplotlib.pyplot add legend by a column value
I'm using Pandas to make a scatter plot. My data look like this:
Locations Lenovo Global Region Primary Function Subsidiaries Apr_2015_to_Mar_2016_[kWh] Apr_2015_to_Mar_2016_[MT] color MT/kWh
...
0
votes
1answer
22 views
Matplotlib plotting subplots to existing figure
I'm wondering if there's an equivalent function to
fig, axarr = plt.subplots(3, 2, sharex='col', sharey='row')
where only the axes array is generated for an existing figure, instead of creating a ...
0
votes
1answer
16 views
Why are my pyplot subplots only taking up half of the figure?
I am creating two subplots, side by side, and for some reason they will only fill the top half of the figure.
grid = {'width_ratios':[3,1],'height_ratios':[1,1]}
self.fig, self.axes = plt.subplots(1,...
0
votes
2answers
35 views
Why use matplotlib instead of some existing software/grapher [on hold]
Hi, I feel like this question might be completely stupid, but I am still going to ask it, as I have been thinking about it.
What are the advantages, of using a plotter like matplotlib, instead of an ...
4
votes
1answer
45 views
3D scatter plot with 2D histogram at sides
I would like to make a 3D scatterplot with with the 2D projections at each side. Something like the following:
The scatterplot has been created with:
fig = plt.figure()
ax = fig.add_subplot(111, ...
0
votes
1answer
6 views
Using Pylab Subplots Function: Lining up subplots with different x axes
I am using the Pylab (pl) subplots function as follows:
f, (ax1, ax2, ax3, ax4) = pl.subplots(4, sharex=True, sharey=False)
Let's say that t0, t1, t2, and t3 are four timestamps in chronological ...