plot

How to use python to separate two gaussian curves?

最后都变了- 提交于 2021-02-19 01:34:45
问题 I measured the fluorescence intensity of thousands of particles and made the histogram, which showed two adjacent gaussian curves. How to use python or its package to separate them into two Gaussian curves and make two new plots? Thank you. 回答1: Basically, you need to infer parameters for your Gaussian mixture. I will generate a similar dataset for the illustration. Generating mixtures with known parameters from itertools import starmap import numpy as np import seaborn as sns import

Add “title” to my factors using facet_grid

家住魔仙堡 提交于 2021-02-19 01:25:09
问题 I would like to add text / title for my factors using ggplot2. For exemple for data from {reshape2} library: library(reshape2) library(ggplot2) ggplot(tips, aes(x=total_bill, y=tip/total_bill)) + geom_point(shape=1) + facet_grid(sex ~ .) Factors labels are: Female and Male. How can I add above them the title "sex"? 回答1: Adapting this answer. Slightly better version. Work out its own width. library(reshape2) library(ggplot2) library(grid) library(gtable) p = ggplot(tips, aes(x=total_bill, y

plotly - where can I find the default color palette used in plotly package [duplicate]

南楼画角 提交于 2021-02-18 21:13:56
问题 This question already has answers here : How to get Plotly.js default colors list? (5 answers) Closed 4 years ago . I am primarily using the plotly package with r to plot my results. I would like to define the colors I use in my presentation document (tables, headings etc.) based on the default colors used in plotly. e.g. the colors used to fill the bars in a bar chart or the parts of a pie chart. Is there a way to find out the rgb or hex values? see the example here: https://plot.ly/r/pie

Wrap multiple plots together in a single image

↘锁芯ラ 提交于 2021-02-18 18:20:47
问题 I am trying to wrap numerous plots together, as they are closely related (showing density using 1 continuous and 1 categorical variable, broken down by day of the week, where each day is a different plot). In R, I can either use grid.arrange() from gridExtra or facet_wrap to wrap visualizations together to return to the user as 1 variable and image containing all plots. It looks like this: How do I do this in Python? 回答1: Yes, this can be done using matplotlib subplots. See this example. The

Fast plotting data in python

℡╲_俬逩灬. 提交于 2021-02-18 17:16:08
问题 I'm trying to plot data from mpu6050 imu with arduino. MPU6050 sends data faster than plot. Arduino code gives 6 data which are yaw, pitch, roll, ax,ay and az from serial port. I need suggestions for fast plot . Python Code: import serial import matplotlib.pyplot as plt #import matplotlib library from drawnow import * ser = serial.Serial('COM9', 115200) yaw = 0.0 pitch =0.0 roll =0.0 ax =0.0 ay =0.0 az =0.0 o_yaw= [0] o_pitch= [0] o_roll= [0] o_ax= [0] o_ay= [0] o_az= [0] plt.ion() cnt=0 def

plotting normal vector in 3d

≡放荡痞女 提交于 2021-02-18 17:05:51
问题 I have a normal vector that I calculated from the cross product of two vectors [xn,yn,zn] and I have a point[x0,y0,z0] how can I plot the normal in 3d. I didn't know how to do it. Any suggestions please? 回答1: With Arrow heads: a = [2 3 5]; % your point [x0,y0,z0] b = [1 1 0]; % your normal vector c = a+b; % end position of normal vector %quiver3 syntax: quiver3(x,y,z,u,v,w) quiver3(a(1), a(2), a(3), c(1), c(2), c(3)); axis equal; This will hopefully draw a vector from your point into the

plotting normal vector in 3d

此生再无相见时 提交于 2021-02-18 17:04:25
问题 I have a normal vector that I calculated from the cross product of two vectors [xn,yn,zn] and I have a point[x0,y0,z0] how can I plot the normal in 3d. I didn't know how to do it. Any suggestions please? 回答1: With Arrow heads: a = [2 3 5]; % your point [x0,y0,z0] b = [1 1 0]; % your normal vector c = a+b; % end position of normal vector %quiver3 syntax: quiver3(x,y,z,u,v,w) quiver3(a(1), a(2), a(3), c(1), c(2), c(3)); axis equal; This will hopefully draw a vector from your point into the

How do I plot time (HH:MM:SS) in X axis in R

这一生的挚爱 提交于 2021-02-18 12:43:05
问题 I have tried to read through stackoverflow, blogs, books etc but have been unable to find the answer on plotting time in the x-axis in the following format(HH:MM:SS.000) in R and another quantity on the y-axis. I have the following dataset: Time EcNo 12:54:09.000 -14.47 12:54:10.000 -17.96 12:54:11.000 -15.97 12:54:12.000 -14.61 12:54:13.000 -12.68 12:54:14.000 -10.73 12:54:15.000 -10.54 12:54:16.000 -11.62 12:54:17.000 -12.49 12:54:18.000 -11.12 How would I plot EcNo on Yaxis vs Time(x axis)

Logarithmic scale plot in R

一笑奈何 提交于 2021-02-18 12:25:10
问题 I want to plot the clustering coefficient and the average shortest- path as a function of the parameter p of the Watts-Strogatz model as following: And this is my code: library(igraph) library(ggplot2) library(reshape2) library(pracma) p <- #don't know how to generate this? trans <- -1 path <- -1 for (i in p) { ws_graph <- watts.strogatz.game(1, 1000, 4, i) trans <-c(trans, transitivity(ws_graph, type = "undirected", vids = NULL, weights = NULL)) path <- c(path,average.path.length(ws_graph))

Bring axes to front without redrawing the figure?

不羁岁月 提交于 2021-02-18 12:10:45
问题 Is there a way in Matlab to bring an axes to front without having Matlab perform a redraw ( drawnow ) implicitly? Background to my question: I am preparing a large figure with several subplots. In some of them I have 2 axes superposed, because I want to see the same data on 2 different y-scales. After playing around with axes settings, I finally got the figure to look like I expected. But: I need to bring one of the axes to front (in my case, the left axes hAxL). So I have this line in my