zmeers / ggparliament

Simple parliament plots using ggplot2
https://zmeers.github.io/ggparliament/
Other
151 stars 13 forks source link

Issue in scale color manual 'limits' argument #45

Closed harnagpal closed 5 years ago

harnagpal commented 5 years ago

I tried running this package on Indian General Elections. I copied the code from documentation and used Indian political parties data as input by changing necessary code. But I keep getting error like given below.

Warning message: Removed 435 rows containing missing values (geom_point)

I made my data similar to election_data dataset but didn't get any success.

Then I copied the original code from package documentation and ran the code on us parliament data with election_data dataset. But issue remained same even with original code and original data. Even chart is not proper.

If I remove scale color manual limits argument then chart comes but still not proper. Please help. Also attaching Indian elections data for reference. I also tried putting same fields as in election_data data set for Indian elections data, but without success. ss.xlsx

zmeers commented 5 years ago

Hi Harish,

Can you please attach a reprex for your example with the data included? Your excel sheet only contains the screenshot of your RStudio console. See this link for further explanation setting up a regex: https://reprex.tidyverse.org/. I ran the US example and it worked on my machine, so I'm not quite sure what the issue is for you. Are you working from the CRAN version of the package or from the development version hosted on GitHub. And which version of ggplot2 are you using?

Thanks! Zoe

harnagpal commented 5 years ago

Thanks Zoe for replying.

Today I again ran the code on us election_data after changing default values in Tools > Global Options by setting 'Save workspace to .RData on exit' to Never. The US code is working fine now.

But I am facing issues in Indian Election Data. I want to plot same for Indian Parliament which has 542 members. I am attaching csv file for your reference. Also attaching R file, and reprex. I find that there are no NAs in the data. But error message shows something related to missing values.

ggplot version is > # ‘3.0.0’

I used RStudio install link to install ggparliament on my PC.

Hope it helps. I am sure I am missing something in my code.

The error message for attached code is:

Warning message: Removed 542 rows containing missing values (geom_point).

Regards, Harish Nagpal, India

On 6/16/19, Zoe Meers notifications@github.com wrote:

Hi Harish,

Can you please attach a reprex for your example with the data included? Your excel sheet only contains the screenshot of your RStudio console. See this link for further explanation setting up a regex: https://reprex.tidyverse.org/. I ran the US example and it worked on my machine, so I'm not quite sure what the issue is for you. Are you working from the CRAN version of the package or from the development version hosted on GitHub. And which version of ggplot2 are you using?

Thanks! Zoe

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/RobWHickman/ggparliament/issues/45#issuecomment-502438588

harnagpal commented 5 years ago

Hi Zoe,

Please ignore my second mail also. Today I used manual values with party and its color and it worked fine with scale_color_manual and 'c' argument.

I didn't use values and limits argument as they were creating problems as I pointed out earlier.

Thanks again for your support. Attaching new plot for your reference.

Regards,

On 6/17/19, Harish Nagpal harnagpal@googlemail.com wrote:

Thanks Zoe for replying.

Today I again ran the code on us election_data after changing default values in Tools > Global Options by setting 'Save workspace to .RData on exit' to Never. The US code is working fine now.

But I am facing issues in Indian Election Data. I want to plot same for Indian Parliament which has 542 members. I am attaching csv file for your reference. Also attaching R file, and reprex. I find that there are no NAs in the data. But error message shows something related to missing values.

ggplot version is > # ‘3.0.0’

I used RStudio install link to install ggparliament on my PC.

Hope it helps. I am sure I am missing something in my code.

The error message for attached code is:

Warning message: Removed 542 rows containing missing values (geom_point).

Regards, Harish Nagpal, India

On 6/16/19, Zoe Meers notifications@github.com wrote:

Hi Harish,

Can you please attach a reprex for your example with the data included? Your excel sheet only contains the screenshot of your RStudio console. See this link for further explanation setting up a regex: https://reprex.tidyverse.org/. I ran the US example and it worked on my machine, so I'm not quite sure what the issue is for you. Are you working from the CRAN version of the package or from the development version hosted on GitHub. And which version of ggplot2 are you using?

Thanks! Zoe

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/RobWHickman/ggparliament/issues/45#issuecomment-502438588

zmeers commented 5 years ago

Awesome, thank you!! Yep, sometimes the manual scale can be a bit fiddly.