2022년 11월 12일 토요일

ch.5 Better Plots

 easier R than SPSS with Rcmdr : Contents

 

ch.5 Better Plots


Let’s add another package.

 

 

Let’s add a package called ‘RcmdrPlugin.Kmggplot2’.

As such, R adds new features each time you add a package. I’ve added something called Rcmdr, and again I’m just installing another one to help with Rcmdr. Because it was created to help Rcmdr, the name RcmdrPlugin is common.

 

 


Click ‘Load Rcmdr Plug-in’ as shown.

 

 Let’s run ‘RcmdrPlugin.Kmggplot2’.

In summary, to run ‘RcmdrPlugin.Kmggplot2’, you need to run R Gui, run R commander, and click ‘Load Rcmdr Plug-in’. It's a bit cumbersome process.

 

A new menu ‘Kmggplot2’ has been created. Again, call the previous dataset.

 

Let’s call the menu ‘Box plot—’.

 

Let’s specify the variables one after the other and the plot as shown in the figure.

 

‘Boxplot with notch’ and ‘Jitter plot’ are drawn at the same time. This notch shows the 95% confidence interval of the median. This is the method I recommend when expressing a group with a small number of samples.

 

 

Let’s change the options as shown above.

 

This will bring up the ‘violin plot’ and ‘dot plot(or Beeswarm plot)’. This is sometimes appropriate.


Let’s select an option as shown above.

 


The error bar, visible as a faint line, represents a 95% confidence interval of the standard error.


Let’s take a look at the options at the bottom of the menu above.

‘Font size’ and ‘Font family’ are easy to understand.

The Colour pattern is to change the color, not just one color, but a bundle of colors.

‘Save graph’ gives you the option to save the graph after it has been created, but I don’t recommend it (as you will learn behind the scenes how to save the graph).

‘Theme’ is an option that allows you to change the theme of the graph to vary the background color or mood. It seems that classic is appropriate for papers, and grey is appropriate for PowerPoint presentations. Try the rest of them respectively and you’ll know.

 

   

 The colors on the left side of this classic theme are using Set1. The right side is the grey theme. You can change the mood in this way. Choosing your own colors and themes and using them consistently saves you time and maintains uniformity.

 


 Select the Histogram.

 

Select Variables. You can arrange Facet sideways (in cols) or up and down (in rows).

 

   

You can also add densitograms or color them. The axis can show the density, the count, or the percentage value. You can apply 3 methods to determine the number of bars one by one and choose the appropriate one.

 

 

Let’s install a new package called ‘RcmdrPlugin.EZR’.

 


And Let’s call ‘RcmdrPlugin.EZR’.

 

A new menu (red square) appears, and the original menu is abbreviated to one. This means that some plug-ins may even change the menu.

 

Let’s choose ‘Bar graph (Means)’.

 

Select the variable and also select the type of ‘Error Bars’. The ‘Condition to limit~’ at the bottom is used when you want to draw only a portion of the data. It’s a very handy feature, but I won’t use it for now.

 

You will see a familiar graph. We have the bar as a mean and added an error bar.

 

You can just save the picture when you download it, but consider doing this as well. Right-click the mouse and select ‘Copy as metafile’. (This method is common to the plots described earlier or described in the future, and has a large scope of use. )

 


Then paste it into PowerPoint. Repeating ‘Ctrl +Shift +G’ 2 times will cause you to repeat ‘Ungroup’ 2 times.

 

Each picture is separated into shapes to form editable.

Now you can edit the color of a shape and change the writing in a familiar way. We recommend that you do this, then save it to PowerPoint and convert it to a picture file or PDF. When you want to decrease or increase the size, it must be regrouped (Ctrl +G) and then do.

If you move it to PowerPoint, you can organize all the graphs used in a study into one file, or publish them later. In particular, it’s nice to be able to edit the one with the variable name in the title of the axis. You can fix ‘Supply’ to ‘the amount of supply’, for example.


easier R than SPSS with Rcmdr : Contents

=================================================

  • R data visualization book 2
https://tinyurl.com/R-plot-II-2  simple variables
https://tinyurl.com/R-plot-II-3-4   many variables / map
https://tinyurl.com/R-plot-II-5-6   time related / statistics related
https://tinyurl.com/R-plot-II-7-8   others / reactive chart 
  

댓글 없음:

댓글 쓰기