scatter

Understanding matplotlib verts

强颜欢笑 提交于 2019-11-28 12:44:51
I'm trying to create custom markers in matplotlib for a scatter plot, where the markers are rectangles with fix height and varying width. The width of each marker is a function of the y-value. I tried it like this using this code as a template and assuming that if verts is given a list of N 2-D tuples it plots rectangles with the width of the corresponing first value and the height of the second (maybe this is already wrong, but then how else do I accomplish that?). I have a list of x and y values, each containing angles in degrees. Then, I compute the width and height of each marker by field

Make a Scatter Plot in matplotlib with dates on x axis and values on y

百般思念 提交于 2019-11-28 07:51:20
问题 I am having trouble making a scatter plot that has from a date array and a bunch of PM 2.5 values. My lists would look like the following: dates = ['2015-12-20','2015-09-12'] PM_25 = [80, 55] 回答1: import pandas as pd dates = ['2015-12-20','2015-09-12'] PM_25 = [80, 55] dates = [pd.to_datetime(d) for d in dates] plt.scatter(dates, PM_25, s =100, c = 'red') s sets the size c sets the color There are a whole bunch of other args as well: http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot

How to do a scatter plot with empty circles in Python?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 02:53:11
In Python, with Matplotlib, how can a scatter plot with empty circles be plotted? The goal is to draw empty circles around some of the colored disks already plotted by scatter() , so as to highlight them, ideally without having to redraw the colored circles. I tried facecolors=None , to no avail. Gary Kerr From the documentation for scatter: Optional kwargs control the Collection properties; in particular: edgecolors: The string ‘none’ to plot faces with no outlines facecolors: The string ‘none’ to plot unfilled outlines Try the following: import matplotlib.pyplot as plt import numpy as np x =

Changing marker style in scatter plot according to third variable

℡╲_俬逩灬. 提交于 2019-11-28 02:48:42
问题 I am dealing with a multi-column dictionary. I want to plot two columns and subsequently change color and style of the markers according to a third and fourth column. I struggle with changing the marker style in the pylab scatter plot. My approach, which works for color, unfortunately does not work for marker style. x=[1,2,3,4,5,6] y=[1,3,4,5,6,7] m=['k','l','l','k','j','l'] for i in xrange(len(m)): m[i]=m[i].replace('j','o') m[i]=m[i].replace('k','x') m[i]=m[i].replace('l','+') plt.scatter(x

How to specify different color for a specific year value range in a single figure? (Python)

荒凉一梦 提交于 2019-11-28 02:22:18
问题 I've a time-series dataset, from 1992-2017. I can set a color for the whole data dots but what I want is to set desired color for specific year range. For Example; from 1992-1995 "Blue", from 1995-2005 "Red" etc. How can we do that? Dataset has 2 columns; year and value. import numpy as np import pandas as pd from scipy import stats from sklearn import linear_model from matplotlib import pyplot as plt import pylab import matplotlib.patches as mpatches import matplotlib.pyplot as plt import

“Error: Continuous value supplied to discrete scale” in default data set example mtcars and ggplot2

做~自己de王妃 提交于 2019-11-27 23:31:39
问题 I am trying to replicate the example here (sthda.com) using the following code: # Change point shapes and colors manually ggplot(mtcars, aes(x=wt, y=mpg, color=cyl, shape=cyl)) + geom_point() + geom_smooth(method=lm, se=FALSE, fullrange=TRUE)+ scale_shape_manual(values=c(3, 16, 17))+ scale_color_manual(values=c('#999999','#E69F00', '#56B4E9'))+ theme(legend.position="top") The example on that web page says that code should produce the following result: But when I run it in R, I get the

R- plot numbers instead of points

六月ゝ 毕业季﹏ 提交于 2019-11-27 22:05:06
问题 I have successfully made a scatterplot, with different symbols for each data series. But what I want to do is make the same scatterplot with the point to show up as numbers. Not the value of each point, just an assigned number. As of right now, I have three depths I am plotting (0, 3, 6cm). I have all my 0cm as triangles, etc. I want my 0cm points to be the character 0, the 3cm points to show up as 3, and the 6cm points to show up as 6. Is this possible? 回答1: Sure, just pass the pch parameter

matplotlib scatter edge without specifying edgecolor

[亡魂溺海] 提交于 2019-11-27 16:14:36
It seems that now the default scatter plot marker is a filled circle without an edge. I want a marker with an edge and with facecolor="none". But if facecolor="none" but edgecolor is not specified, then the plot is empty. I want markers be in multiple distinct colors, but don't care which one has which color. How can I just "turn on" the edges? There are two ways to produce empty or hollow scatter markers: Setting facecolor to "none" Instead of "just turning on" the edges, you may "turn off" the faces. So in order to make the facecolors of scatter markers transparent you may set the facecolor

Gnuplot: How to make scatter plots with transparent points

人走茶凉 提交于 2019-11-27 14:47:41
问题 How can I plot an image with partial transparent scatter points just like in this picture with gnuplot? The problem is I don't know how to set the points to be transparent. 回答1: Try this: set style fill transparent solid 0.35 noborder set style circle radius 0.02 plot 'test' u 1:2 with circles lc rgb "blue", \ '' u 1:2 every 100 w circles lc rgb "red" fs solid 1.0 border lt -1 which outputs As you can see, you can specify for each data set whether to use transparency and which color to use.

Partially transparent scatter plot, but with a solid color bar

我只是一个虾纸丫 提交于 2019-11-27 12:00:00
问题 In Python, with Matplotlib, how to simply do a scatter plot with transparency (alpha < 1), but with a color bar that represents their color value, but has alpha = 1? Here is what one gets, with from pylab import *; scatter(range(10), arange(0, 100, 10), c=range(10), alpha=0.2); color_bar = colorbar() : How can the color bar be made non-transparent? PS : I tried color_bar.set_alpha(1); draw() , but this did not do anything… 回答1: Alright, I found one way to do it, that looks relatively clean: