scatter

Matplotlib: add twin y axis without using its values in the plots

做~自己de王妃 提交于 2020-01-02 13:32:07
问题 This is to clarify the question title. Say you have four lists of integers, with which you want to produce a scatter plot: a=[3,7,2,8,12,17] b=[9,4,11,7,6,3] c=[9,3,17,13,10,5] d=[5,1,1,14,5,8] You also have a function, for simplicity f(x)=1/x , that applies to all lists, so that: from __future__ import division a1=[1/i for i in a] b1=[1/i for i in b] c1=[1/i for i in c] d1=[1/i for i in d] My question: how to add a second y axis, knowing that the values returned by the function range from 0

First set of (scatter) plot data remains on the graph during animation with Python's matplotlib

十年热恋 提交于 2019-12-31 03:06:28
问题 I'm trying to animate a line and 3 scatter points on a graph. Everything seems to be working except the first set of scatter points don't get removed on the graph. Here is the code, you can try setting n equal to 1, 2 or 3 import numpy as np from math import * from pylab import * from matplotlib import pyplot as plt from matplotlib import animation # Constants isqrt = 2**(-0.5) omega = np.sqrt(2-np.sqrt(2)) #Angular velocity L=4 #Length of the system n = 1 #Normal mode number if n==1: z =

How to assign specfic colours to specifc categorical variables in R?

。_饼干妹妹 提交于 2019-12-25 02:43:28
问题 I'm a complete beginner to R and have this question. I'm using the following code to generate a colour list and then create a massive scatterplot matrix. I want to assign specific colours to the first column of my matrix(categorical with 4 categories). Running this code works fine but how do I verify that the colours that I intend to specify for each of the categorical variables is correct? Basically I want to achieve green for 'control', orange for 'low', brown for 'medium' and black for

Scatter plot with string X and Y coordinates

怎甘沉沦 提交于 2019-12-24 16:06:23
问题 I did see this, but I was wondering if there is a way to do it without pandas. This is what I have tried. X_AXIS , and Y_AXIS are strings that are contained in xTickMarks and yTickMarks , respectively. Each value in X_AXIS and Y_AXIS has a corresponding Z_AXIS value..and the the size of the scatter point is represented using the list FREQ . xTickMarks = ["0B", "1B", "2B", "1B3S", "2B2S"] yTickMarks = ["-1S","0S", "1S", "2S", "3S", "4S"] matplotlib.rc('font', serif='Helvetica Neue') matplotlib

showing similar value in x and y-axis in matlab

旧巷老猫 提交于 2019-12-24 09:26:11
问题 i have matrix as below; from the calculation there will be some value that will be have same value to each other when plotting in graph (i used scatter plot), the question here is how to know/identify which calculation is giving the matching data and can it be stored in the table. i have tried used find function in matlab but error occured. A = [2/3 -1/3 -1/3; -1/3 2/3 -1/3; -1/3 -1/3 2/3]; B=[0 0 0; 0 0 1; 0 1 0; 0 1 1; 1 0 0; 1 0 1; 1 1 0; 1 1 1]; d= [2/3 -1/3 -1/3]; q = [0 0.5773 -0.5773];

boxplot the data of the y-axis of a scatter plot using matlab

醉酒当歌 提交于 2019-12-24 02:56:25
问题 What I basically want to do is to have boxplots for one data set on a scatter plot using Matlab. We can do the scatter plot with scatter(X, Y) and instead of the points corresponding to Y , I would like to have boxplots. Something like scatter(X, (boxplot(Y)) - which of course does not work. Have been searching high and low but could not find a relevant answer, or even something similar. The scatter-points from the left-hand side have to be replaced with box plots as on the right: 来源: https:/

plot ordering/layering julia pyplot

纵然是瞬间 提交于 2019-12-24 02:25:32
问题 I have a subplot that plots a line (x,y) and a particular point (xx,yy). I want to highligh (xx,yy), so I've plotted it with scatter . However, even if I order it after the original plot, the new point still shows up behind the original line. How can I fix this? MWE below. x = 1:10 y = 1:10 xx = 5 yy = 5 fig, ax = subplots() ax[:plot](x,y) ax[:scatter](xx,yy, color="red", label="h_star", s=100) legend() xlabel("x") ylabel("y") title("test") grid("on") 回答1: You can change which plots are

Fast zipping folder using java ParallelScatterZipCreator

和自甴很熟 提交于 2019-12-24 02:19:05
问题 What should be the value of or initialize InputStreamSupplier? I was trying to zip all the files in a directory and that should be fast. So multi threading is the option i'm going for. public class ScatterSample { ParallelScatterZipCreator scatterZipCreator = new ParallelScatterZipCreator(); ScatterZipOutputStream dirs = ScatterZipOutputStream.fileBased(File.createTempFile("scatter-dirs", "tmp")); public ScatterSample() throws IOException { } public void addEntry(ZipArchiveEntry

Python scatter plot with numpy-masked arrays

被刻印的时光 ゝ 提交于 2019-12-23 18:30:56
问题 I'm stuck trying to mask data for a scatter plot. All data seems to plot. I'm using numpy arrays as shown in the snippet below. I'm thinking that perhaps I cannot mask on the "c" array. I can't seem to find any documentation for doing this. I'll try with the "s" array. Any help is greatly appreciated. yy = NP.ma.array(yy) xx = NP.ma.array(xx) zz_masked = NP.ma.masked_where(zz <= 1.0e6 , zz) scatter(xx,yy,s=15,c=zz_masked, edgecolors='none') cbar = colorbar() show() 回答1: Works for me. Each

Circle Plot with Color Bar

帅比萌擦擦* 提交于 2019-12-23 18:07:06
问题 I'm trying to do a Circle Plot with a Color Bar, almost like this: However, the minimum value of the colour bar is currently 1; I would like to be able to set it to 0. import pandas as pd import matplotlib.pyplot as plt import matplotlib.cm as cm from sklearn import preprocessing df = pd.DataFrame({'A':[1,2,1,2,3,4,2,1,4], 'B':[3,1,5,1,2,4,5,2,3], 'C':[4,2,4,1,3,3,4,2,1]}) # set the Colour x = df.values min_max_scaler = preprocessing.MinMaxScaler() x_scaled = min_max_scaler.fit_transform(x)