scatter

Python scatter plot. Size and style of the marker

怎甘沉沦 提交于 2019-11-27 11:20:08
I have a set of data that I want to show as a scatter plot. I want each point to be plotted as a square of size dx . x = [0.5,0.1,0.3] y = [0.2,0.7,0.8] z = [10.,15.,12.] dx = [0.05,0.2,0.1] scatter(x,y,c=z,s=dx,marker='s') The problem is that the size s that the scatter function read is in points^2. What I'd like is having each point represented by a square of area dx^2, where this area is in 'real' units, the plot units. I hope you can get this point. I also have another question. The scatter function plots the markers with a black border, how can I drop this option and have no border at all

How to add trendline in python matplotlib dot (scatter) graphs?

女生的网名这么多〃 提交于 2019-11-27 07:24:10
How could I add trendline to a dot graph drawn using matplotlib.scatter? martinenzinger as explained here With help from numpy one can calculate for example a linear fitting. # plot the data itself pylab.plot(x,y,'o') # calc the trendline z = numpy.polyfit(x, y, 1) p = numpy.poly1d(z) pylab.plot(x,p(x),"r--") # the line equation: print "y=%.6fx+(%.6f)"%(z[0],z[1]) 来源: https://stackoverflow.com/questions/26447191/how-to-add-trendline-in-python-matplotlib-dot-scatter-graphs

Understanding matplotlib verts

我只是一个虾纸丫 提交于 2019-11-27 07:12:55
问题 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

matplotlib scatter plot colour as function of third variable

假如想象 提交于 2019-11-27 04:22:56
I would like to know how to make matplotlib's scatter function colour points by a third variable. Questions gnuplot linecolor variable in matplotlib? and Matplotlib scatterplot; colour as a function of a third variable posed similar queries, however, the answers to those questions don't address my issue: the use of c=arraywhichspecifiespointcolour in the scatter function only sets the fill colour, not the edge colour. This means that the use of c=arr... fails when using markersymbol='+' , for instance (because that marker has no fill, only edges). I want points to be coloured by a third

Python scatter plot. Size and style of the marker

若如初见. 提交于 2019-11-27 04:02:41
问题 I have a set of data that I want to show as a scatter plot. I want each point to be plotted as a square of size dx . x = [0.5,0.1,0.3] y = [0.2,0.7,0.8] z = [10.,15.,12.] dx = [0.05,0.2,0.1] scatter(x,y,c=z,s=dx,marker='s') The problem is that the size s that the scatter function read is in points^2. What I'd like is having each point represented by a square of area dx^2, where this area is in 'real' units, the plot units. I hope you can get this point. I also have another question. The

MPI partition matrix into blocks

烂漫一生 提交于 2019-11-27 03:40:46
I want to partition matrix into blocks (not stripes) and then distribute this blocks using MPI_Scatter. I came up with solution which works, but I think it is far from "best practice". I have 8x8 matrix, filled with numbers from 0 to 63. Then I divide it into 4 4x4 blocks, using MPI_Type_vector and distribute it via MPI_Send, but this require some extra computation since i have to compute offsets for each block in big matrix. If I use scatter, first (top left) block is transfered OK, but other blocks are not (wrong offset for start of block). So is it possible to transfer blocks of matrix

Scale matplotlib.pyplot.Axes.scatter markersize by x-scale

守給你的承諾、 提交于 2019-11-27 02:09:47
I would like to scale the markersize of matplotlib.pyplot.Axes.scatter plot based on the number of points on the x/y-axis. import matplotlib.pyplot as plt import numpy as np vmin = 1 vmax = 11 x = np.random.randint(vmin, vmax, 5) y = np.random.randint(vmin, vmax, 5) fig, ax = plt.subplots() for v in np.arange(vmin, vmax): ax.axvline(v - 0.5) ax.axvline(v + 0.5) ax.axhline(v - 0.5) ax.axhline(v + 0.5) ax.set_xlim(vmin - 0.5, vmax + 0.5) ax.set_ylim(vmin - 0.5, vmax + 0.5) ax.scatter(x, y) ax.set_aspect(1) plt.show() ax is always using an equal aspect ratio and both axes have the same lim values

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

巧了我就是萌 提交于 2019-11-26 23:50:59
问题 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. 回答1: 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’

matplotlib scatter edge without specifying edgecolor

自作多情 提交于 2019-11-26 18:33:28
问题 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? 回答1: 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

matlab: scatter plots with high number of datapoints

試著忘記壹切 提交于 2019-11-26 16:42:42
问题 I'm trying to plot scatter, something like: scatter(coor(:, 2), coor(:, 3), 1, coor(:, 4)); The problem is, that I have quite big number of coordinates to plot (~100 000). Its taking long time to plot it, and when I try to export figure to tiff - then matlab is dead for goooood few minutes... Any solution to improve plotting, or at least tiff export? EDIT: Forgot to mention, 3rd coordinate (coor(:, 4)) is a color code. So, when I'm using scatter (as above), I have something like on the image