During the process of ggplot, an Error of “Error: stat_bin() must not be used with a y Aesthetic.”
code is as follows:
> ggplot(aes(x = gender, y = age),
+ data = subset(pf, !is.na(gender))) + geom_histogram()
Error: stat_bin() must not be used with a y aesthetic.
> ggplot(aes(x = age, y = friend_count),
+ data = subset(pf, !is.na(gender))) + geom_histogram()+
+ facet_wrap(~gender,ncol = 1)
Error: stat_bin() must not be used with a y aesthetic.
Stat_bin indicates that the statistical transformation is the count, and the count will be projected onto the Y-axis, which conflicts with y=1. Therefore, stat_bin() must not be used with a y aesthetic.
here is mainly because the histogram is a single-factor variable visualization method, and the Y-axis cannot be added in aes parcel. The correct code can be replaced as follows:
ggplot(aes(x = friend_count),
data = subset(pf, !is.na(gender))) + geom_histogram()
ggplot(aes(x = friend_count),
data = subset(pf, !is.na(gender))) + geom_histogram()+
facet_wrap(~gender,ncol = 1)
Read More:
- Taro Install Error: permission denied, symlink ‘../lib/node_modules/@tarojs/cli/bin/taro‘ -> ‘/usr/local/bin/tar
- Rendering Problems The following classes could not be instantiated: xml layout file could not be loaded
- Bazel error executing command /usr/bin/gcc @bazel-out/k8-fastbuild/bin/flashroute/flashroute-2.p
- [Solved] bin/hive Startup Error: Operation category READ is not supported in state standby
- Bin File Programming Failed, could not find core in coresight setup, erase error
- [Solved] swiper Error: The requested module ‘react’ is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export
- [Solved] Error: Main class not found or could not be loaded com.jawasoft.
- Postgis Install Error: could not load library “C:\……“:The specified module could not be found.
- /usr/bin/ld: skipping incompatible Error [How to Fix]
- /usr/bin/ssh-copy-id: ERROR [How to Solve]
- Error: cannot find module ‘webpack cli/bin/config yargs’‘
- The application could not be installed: INSTALL_FAILED_USER_RESTRICTED
- [Solved] Toad Set Error: The following files specified on the Executables tab could not be found:TNS Ping
- [Solved] ECharts Console Error: `resize` should not be called during main process
- How to Solve “/usr/bin/ld: skipping incompatible”
- [Solved] Pylink Windows Chinese path error: Specified file could not be opened
- [Solved] void value not ignored as it ought to be
- [Solved] Feign Error: -‘oauth-client.FeignClientSpecification‘ could not be registered
- [Solved] Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
- [Solved] ROS sudo rosdep init error: could not be downloaded