Hot answers tagged

7 votes
Accepted

Represent time-series data in much compact form

Simulate some data: ...
  • 351
6 votes
Accepted

How to plot multiple columns with ggplot in R?

If I understand right your question, you are looking to plot selected numerical columns against a selected categorical column of your dataset, am I right ? If so, you can have the use of ...
  • 196
5 votes
Accepted

When Should I Use ggplot2 Instead of Tableau?

There is one big economic difference between the two: ggplot2 is an open source package for an open source programming language. On the contrary Tableau is a proprietary software. That might be a ...
4 votes
Accepted

ggvis vs. ggplot2+Shiny; which one to choose for interactive visualization?

Well, many months have been passed from this help request. I write this answer to my own request in order to share my experience. I learned ggplot2 and then ...
  • 271
4 votes

ggplot (in R)/matplotlib (in Python) with linear model?

I don't know what you mean by "with linear model" in the title, but here's code that generates a toy dataset and replicates your plot. ...
3 votes
Accepted

Adding a trend line or horizontal mean±stdev lines in facet_grid view

What you can do is creating another dataset with the mean and mean±stdev grouped by Tier. Then you can use that in geom_hline ...
  • 286
3 votes

Mirror column plot with different y-axis in ggplot

You can either reshape the data into long format (after joining the two datasets) and use geom_col once, or have two geoms as you have in your question. However, ...
  • 286
3 votes

Represent time-series data in much compact form

Two alternative way are a density plot for each hour and level plot of hour and factorized value. I'm showing ganarated data with two different unified distribution (for day and night hours) ...
3 votes
Accepted

Manage x-axis using ggplot()

Change Year to a factor and add group=1: ...
  • 351
3 votes
Accepted

R: Producing multiple plots (ggplot, geom_point) from a single CSV with multiple subcategories

something like this might work: ...
  • 23.8k
2 votes

ggvis vs. ggplot2+Shiny; which one to choose for interactive visualization?

Time flies! After 2years of working experience, now I answer to my own question with better understanding of Shiny,R, and interactive visualization. The Plotly is by far the best answer. It can be ...
  • 271
2 votes
Accepted

R: lattice equivalent of density2d in ggplot?

Use a custom panel function in which the density is estimated (e.g. using MASS::kde2d()): ...
  • 700
2 votes

How to summarize(add) a column according to same year and plot in R?

Step 1: Changing dates to years First you can change your column of dates (Order_Date) to simply years by using this formula: ...
  • 146
2 votes
Accepted

How to visualize categorical data with numeric columns

Clearly there's no way to have the names of the drugs. Assuming the relation between the two columns is important, a scatter plot with units prescribed as X and number of patients as Y might work. You ...
  • 23.8k
1 vote

How to change legend labels in line plot with ggplot2?

Solution = move all of the arguments to scale_linetype_manual(): ...
  • 39
1 vote

Fit non-linear customised model

You could try quantile regression using a "generalised additive" model. With R you could use the qgam package, I guess....
  • 7,064
1 vote
Accepted

ggplot2 for Cluster analysis (non-readible row names)

Try adding theme to your plot layout So: ...
  • 2,296
1 vote
Accepted

Plot two categorical variables against two numeric variable in ggplot

Two things before the answer: Please always produce a sample dataframe with dput() As this is totally coding based, this might be more suitable for StackOverflow ...
1 vote
Accepted

How can I plot a line for time series data with categorical intervals in R

Would something like this work? I simply add an extra column that indicates the row number (which is later used as the x-axis) to make sure all values are displayed as a new point instead of plotting ...
  • 6,524
1 vote

How to get a (descriptive) overview of a large database?

There's no way to have a complete summary of a large dataset like this, you have to analyze what can be relevant, decompose into more specific pieces of information and then find the best way to ...
  • 23.8k
1 vote

How to create a barplot using multiple column

The function you are looking for is gather from the tidyr package. This function takes a wide data.frame and makes it a long ...
1 vote

An appropiate data visualization?

Whenever you give percentages, you need a very clear statement about the denominator. I can deduce it here, but in general one could give the percentage of bike only accidents of all accidents in the ...
1 vote

An appropiate data visualization?

Looking into so many plots may miss the bigger picture. We should keep the initial plot in "One Consolidated plot" e.g. Can add few other consolidated views - Pie on aggregated data on ...
  • 5,384
1 vote

R: Producing multiple plots (ggplot, geom_point) from a single CSV with multiple subcategories

I finally figured out something that works: ...
  • 35
1 vote
Accepted

Y-axis output is not order

It is in order, but not in the order that you want. It is currently treating the indices as a string. To get your desired index as numerics, here are some codes that hopefully can help you. ...
1 vote
Accepted

How to make a Power Spectral Density Plot in R

From further research I've discovered that the frequency is given by the index of the FFT multiplied by the sampling rate and divided by the size of the array. And the amplitude is the magnitude of ...
1 vote

When Should I Use ggplot2 Instead of Tableau?

This doesn't answer your Tableau questions, but I can say a few things about ggplot2. ggplot2's has reasonable defaults but nearly everything about the plots can be changed to make the results more ...
  • 2,158
1 vote

R recommendations while applying ggplot2 and plotly together to plot a graph

Plotly is R package for creating interactive web-based graphs via plotly's JavaScript graphing library, plotly.js. The plotly R libary contains the ggplotly function , which will convert ggplot2 ...
1 vote

How to plot two distribution curves in a faceted way in R/ggplot2?

I would separate the creation of the data from the plotting operation, if I were you. ggplot2::facet_wrap allows you to plot each of the cumulative distributions in ...
  • 111
1 vote

Interactive Data Visualisations

You could give the plotlypackage a try. You basically code up the plot you want first with ggplot2 and then call ...
  • 236

Only top scored, non community-wiki answers of a minimum length are eligible