wish of those help I used read.xlsx to get a data from excel. What I want to do with the data is that I want to plot a scatterplot with latitude as my yaxis and longitude as my xaxis. I want to have a count label such that it shows the scale of my value and with the lower value colored blue and the highest value being red. How do I do this? Currently this is my data. , Try: code :
getdata < data.frame(
latitude=c(22.23418, 1.15923, 37.60778, 27.65468, 33.61151),
longitude=c(80.71113, 115.82203, 96.09940, 127.00649, 166.54130),
Value=c(0.696, 0.686, 0.459, 0.718, 0.837))
library(ggplot2)
ggplot(data=getdata, aes(x = longitude, y = latitude, color=Value))+
geom_point()+
scale_color_continuous( low = "blue", high = "red")
Share :

Plotting means as a line plot onto a scatter plot with ggplot
By : Fab
Date : March 29 2020, 07:55 AM
around this issue I have this simple data frame holding three replicates (value) for each factor (CT). I would like to plot it as geom_point and than the means of the point as geom_line. , You should set the group aes to 1: code :
ggplot(df, aes(x=CT, y=value)) + geom_point() +
stat_summary(aes(y = value,group=1), fun.y=mean, colour="red", geom="line",group=1)

matplotlib: plotting histogram plot just above scatter plot
By : James4589
Date : March 29 2020, 07:55 AM
I wish this help you I would like to make beautiful scatter plots with histograms above and right of the scatter plot, as it is possible in seaborn with jointplot: , Here's an example of how to do it, using gridspec.GridSpec: code :
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
import numpy as np
x = np.random.rand(50)
y = np.random.rand(50)
fig = plt.figure()
gs = GridSpec(4,4)
ax_joint = fig.add_subplot(gs[1:4,0:3])
ax_marg_x = fig.add_subplot(gs[0,0:3])
ax_marg_y = fig.add_subplot(gs[1:4,3])
ax_joint.scatter(x,y)
ax_marg_x.hist(x)
ax_marg_y.hist(y,orientation="horizontal")
# Turn off tick labels on marginals
plt.setp(ax_marg_x.get_xticklabels(), visible=False)
plt.setp(ax_marg_y.get_yticklabels(), visible=False)
# Set labels on joint
ax_joint.set_xlabel('Joint x label')
ax_joint.set_ylabel('Joint y label')
# Set labels on marginals
ax_marg_y.set_xlabel('Marginal x label')
ax_marg_x.set_ylabel('Marginal y label')
plt.show()

Plot function of x, y as the colour density on a scatter plot?
By : jessamar rayos
Date : March 29 2020, 07:55 AM
With these it helps Say I have a list of heights that a measurement were taken from: , Here's what you need: code :
plt.scatter(angle[x], height_temp, c=slope[x], s=slope[y], cmap='rainbow')

Plotting circles with no fill, colour & size depending on variables using scatter
By : Denys Samoilenko
Date : March 29 2020, 07:55 AM
Hope that helps I believe doing both approaches may achieve what you are trying to do. First draw the unfilled circles, then do a scatter plot with the same points. For the scatter plots, make the size 0 but use it to set the colorbar. Consider the following example: code :
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.cm as cm
%matplotlib inline
# generate some random data
npoints = 5
x = np.random.randn(npoints)
y = np.random.randn(npoints)
# make the size proportional to the distance from the origin
s = [0.1*np.linalg.norm([a, b]) for a, b in zip(x, y)]
s = [a / max(s) for a in s] # scale
# set color based on size
c = s
colors = [cm.jet(color) for color in c] # gets the RGBA values from a float
# create a new figure
plt.figure()
ax = plt.gca()
for a, b, color, size in zip(x, y, colors, s):
# plot circles using the RGBA colors
circle = plt.Circle((a, b), size, color=color, fill=False)
ax.add_artist(circle)
# you may need to adjust the lims based on your data
minxy = 1.5*min(min(x), min(y))
maxxy = 1.5*max(max(x), max(y))
plt.xlim([minxy, maxxy])
plt.ylim([minxy, maxxy])
ax.set_aspect(1.0) # make aspect ratio square
# plot the scatter plot
plt.scatter(x,y,s=0, c=c, cmap='jet', facecolors='none')
plt.grid()
plt.colorbar() # this works because of the scatter
plt.show()

plotting a density plot and a scatter plot on the same figure
By : user2741583
Date : March 29 2020, 07:55 AM

