Home>
CSV file with the following structure
X, Y, freq, h, s, v
A, A, 5,60,255,125
B, A, 0,60,255,0
C, A, 1,60,255,25
D, A, 0,60,255,0
A, B, 0,120,255,0
.
.
.
I read it with R Studio and tried to create a graph with ggplot, but I got an error.
>data<-read.csv ("C: \\ Users \\ Name \\ CSV \\ data.csv", header = T)
>ggplot (data, aes (x = X.axis, y = Y.axis)) +
+ geom_point (aes (size = freq), shape = 21, color = hsv (h, s, v, 0.5), fill = hsv (h, s, v, 0.5)) +
+ scale_size_area (max_size = 20, guide = FALSE) + theme (axis.text.x = element_text (angle = 90, hjust = 1))
Error in hsv (h, s, v, 0.5): Missing object 'h'
Therefore, the part of the color specification was enclosed with aes (), but it seems that aes () does not like anything.
>ggplot (data, aes (x = X.axis, y = Y.axis)) +
+ geom_point (aes (size = freq), shape = 21, aes (colour = hsv (h, s, v, 0.5)), aes (fill = hsv (h, s, v, 0.5))) +
+ scale_size_area (max_size = 20, guide = FALSE) + theme (axis.text.x = element_text (angle = 90, hjust = 1))
Error: `data` must be a data frame, or other object coercible by` fortify () `, not an S3 object with class uneval
Did you accidentally pass `aes ()` to the `data` argument?
Run `rlang :: last_error ()` to see where the error occurred.
>rlang :: last_error ()
<error/rlang_error>
`data` must be a data frame, or other object coercible by` fortify () `, not an S3 object with class uneval
Did you accidentally pass `aes ()` to the `data` argument?
Backtrace:
1.ggplot2 :: geom_point (...)
2.ggplot2 :: layer (...)
4. ggplot2 ::: fortify.default (data)
Run `rlang :: last_trace ()` to see the full context.
By the way, if you do the following, the colors of the bubbles are all gray, but the graph will be drawn successfully.
>ggplot (child.cmp.bub, aes (x = X.axis, y = Y.axis)) +
+ geom_point (aes (size = freq), shape = 21, color = "darkgrey", fill = "grey") +
+ scale_size_area (max_size = 20, guide = FALSE) + theme (axis.text.x = element_text (angle = 90, hjust = 1))
-
Answer # 1
Related articles
- html - when i specify the background color, there is a mysterious margin on the left side
- reactjs - when using the map function in react or jsx, i want to specify the number of items to display
- ios - how to specify height of uitableview using xcode autolayout
- css - i want to specify a gradient color for background
- bubble sort quick sort using clock function of c language
- html - i want to specify a color for the before element as well
- c# - when using urp of unity, the material color of the object far from the camera becomes light
- ruby on rails - i want to specify a path using the if statement when data is included and when it is not
- how to write iterative process using "for" in r language
- javascript - i want to correct the color tone of an image using canvas
- android - i want to be able to adjust the color of the image using seekbar
- cbind method using r listfiles
- order selection using aic in time series analysis
- how to set branch of regression tree (decision tree) using partykit (i want to make it vertical)
- how to specify the sort order when using sorted in python
- when using a sequence for filter processing, some rows that meet the conditions disappear
- flutter - i want to specify the color of the input character of textfield in theme
- java - bubble sort using list
- python - how to specify the license when using the google custom search api
- i want to put an error bar using standard error (sem) in ggplot2
Related questions
- r : Change ggplot legend options
- regarding the method to output the histograms of all columns at once
- changing the shape and color of dot plot of ggplot
- r - about handling geom_vline in ggplot2
- i don't know how to format data for graph drawing with r and ggplot
- coastline plot in r
- r - i want to use a function instead of opts in ggplot2
- cannot create line graph with ggplot2
- [r] method to output boxplot graph of r by condition (aes(fill=●●) cannot be used for color coding)