scatter-plot

R - Extending Linear Model beyond scatterplot3d

跟風遠走 提交于 2021-01-28 05:02:37
问题 I have created a scatterplot3d with a linear model applied. Unfortunately the results of the LM are subtle and need to be emphasised, my question is how can I extend the LM grid outside of the 'cube'. Plot: Code: Plot1 <-scatterplot3d( d$MEI, d$YYYYMM, d$AOELog10, pch=20, grid = FALSE, color = "black", xlab="MEI", ylab="Date", zlab="AOE Log(10)" ) fit <- lm(d$AOELog10 ~ d$MEI+d$Rank) Plot1$plane3d(fit) Now I guess it might be a variable within lm(), but I cant find anything.... 回答1: To see a

Python_DF ordering and customdata in Plotly

穿精又带淫゛_ 提交于 2021-01-28 01:52:02
问题 I have issue with wrong reflection data in hovers in the code below. See code with comments for each block. I have issue with wrong reflection data in hovers in the code below. See code with comments for each block. import plotly.express as px import pandas as pd import plotly.graph_objects as go rows=[['501-600','15','122.58333','45.36667','Name1'], ['till 500','4','12.5','27.5','Name2'], ['more 601','41','-115.53333','38.08','Name3'], ['till 500', '26', '65.5', '29.5','Name4'], ['501-600',

Edit marker shape in python

北城余情 提交于 2021-01-07 02:41:28
问题 I'm using diamond pointer on the x-axis of a CDF plot to show the distribution of some data. As the number of data is high, these points are close together and not distinguishable. I was wondering if there is a way to make the diamond marker for scatter plot more pointy . 回答1: You can define your own markers from a path, see the Marker Path Example. import matplotlib.pyplot as plt import matplotlib.path as mpath pointed_diamond = mpath.Path([[0,-.5],[-.1,0],[0,.5],[.1,0],[0,-.5]], [1,2,2,2,79

Rainbow scatter plot Python

若如初见. 提交于 2021-01-07 01:39:35
问题 I have to make the following scatterplot in python. The code for this plot is : n = 1024 X = np.random.normal(0,1,n) Y = np.random.normal(0,1,n) plt.scatter(X,Y) But as espected, this wont give the colours. I've tried a lot, but can't find the solution. I know it has something to do with the angle of X/Y in the plot, but can't find out how to do this. 回答1: The logic is most likely angle from origo to point. This can be calculated easily with np.arctan2(X, Y) . I don't know which colormap that

How to add a point on the y-intercept (y-axis) using ggplot2

纵饮孤独 提交于 2020-12-25 10:38:24
问题 I have a scatter plot where the y-axis scaling changes at a certain point to plot data with some extreme values. I'm trying to add some sort of visual cue on the y-axis that indicates that the scaling changes at the point. Here's an example of a plot library(scales) library(ggplot2) set.seed(104) ggdata <- data.frame('x' = rep('a',100), 'y' = c(runif(90, 0, 20), runif(10, 90, 100))) transformation <- trans_new( "my_transformation", transform = function(x) ifelse(x <= 30, x / 5, (x - 30) / 20

Sort categorical x-axis in a seaborn scatter plot

自闭症网瘾萝莉.ら 提交于 2020-12-15 04:41:26
问题 I am trying to plot the top 30 percent values in a data frame using a seaborn scatter plot as shown below. The reproducible code for the same plot: import seaborn as sns df = sns.load_dataset('iris') #function to return top 30 percent values in a dataframe. def extract_top(df): n = int(0.3*len(df)) top = df.sort_values('sepal_length', ascending = False).head(n) return top #storing the top values top = extract_top(df) #plotting sns.scatterplot(data = top, x='species', y='sepal_length', color =

Get color of a scatter point

故事扮演 提交于 2020-12-05 07:21:29
问题 I have a scatter plot with some toy data. I want to draw a label next to a given point with the color of the point. Toy example: x = 100*np.random.rand(5,1) y = 100*np.random.rand(5,1) c = np.random.rand(5,1) fig, ax = plt.subplots() sc = plt.scatter(x, y, c=c, cmap='viridis') # I want to annotate the third point (idx=2) idx = 2 ax.annotate("hello", xy=(x[idx],y[idx]), color='green', xytext=(5,5), textcoords="offset points") plt.show() I need to somehow get the color of this point and change