![]() ![]() Line chart of Zillow data created with echarts4r. houses_wide %>% e_charts(x = Month) %>% e_line(serie = `San Francisco`) Screen shot by Sharon Machlis, IDG The argument is called serie, as in singular of series. It needs at least one argument, the column with the values. For a line chart, that’s the e_line() function. Next, I’ll add the type of chart I want and the y-axis column. You’ll see the x axis but no y axis or data.ĭepending on your browser width, all the axis labels may not display because echarts4r is responsive by default - you don’t have to worry about the axis text labels overwriting each other if there's not enough room for them all. If you’re familiar with ggplot, this first step is similar: It creates an object, but there’s no data in the visualization yet. In the code below, I create a basic echarts4r object with Month as the x-axis column. You can install the dev version with these lines: remotes::install_github"JohnCoene/echarts4r") library(echarts4r) library(dplyr) I’ll start by loading the echarts4r and dplyr packages. Note I’m using the development version of echarts4r to access the latest version of the echarts JavaScript library. My houses_wide data frame has one column for Month (I’m just looking at December for each year starting in 2007) and columns for each city. If you want to follow along, data instructions are at the end of this article. Line charts with echarts4rįor example data, I downloaded and wrangled some housing price info by US city from Zillow. Next, you add a function for the type of chart ( e_line(), e_bar(), etc.) with the y-axis series column name as an argument.That takes your data frame and x-axis column as arguments. ![]() You start coding a visualization by creating an echarts object with the e_charts() function.Every function in the package starts with e_.Package author John Coene explains the basics in a getting started page: ![]()
0 Comments
Leave a Reply. |