Git Product home page Git Product logo

ggparliament's People

Contributors

leeper avatar robsalasco avatar robwhickman avatar zmeers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ggparliament's Issues

Unknown or uninitialised column: 'party'.

parliament_data giving this error. Everything seems to be working so I assume its a case of just going through the code and removing this. Will leave it for the immediate future as it isn't breaking anything

Maintenance

Hi Rob,

Is this package still being actively maintained? If not, would you be interested in handing the package off or adding co-ownership to the repository?

Thanks,
Zoe

r2d3 interactivity

It would be nice to include d3-parliament in the package so users can create interactive parliament plots with minimal work on their end.

error with german government data

wayyyy back when we started this I don't think there was actually a coalition in Germany so I can't remember why I went with what I did.

Anyway, for the 2017 election it should be the CDU and the SDP in government

Add some additional arguments

  • make labels optional: party name, number of seats, both, or neither
  • other styles:
    • "bar"
    • "pie"
    • "rose"
    • "waffle"
    • "u" - for Australian-style U-shaped parliament
  • allow arbitrary number of rings in arc-style?
  • seat total as a huge number in the center like in similar packages
  • line showing majority threshold

Submission to CRAN

We tentatively plan to submit to CRAN on the 20th of August, with a firm deadline for the end of August.

Sort parties by ideological position

Dear all,

is it possible to create a plot which sorts the parliamentary parties by their ideological orientation, e.g. from far left to far right. This should be an important issue, because this type of parliamentary visualization is very common in Political Science and journalism.

Thanks in advance!

scale_colour_party()

I'll create a PR for scale_colour_party() once the repository has been transferred to Rob's account.

order of parties?

hi
I have been trying to plot this kind of seat diagram for a long time. Thank you for such a powerful tool. It works well.
I have a confusion though. It seems to me that the order of parties in the graph is the same, or has to be the same as the order in the data, d or d2. As you did in your examples, Party in d is a factor, but the labels seems not work.
My codes are like this:

d <- data.frame(Party = factor(c("V","S","MP","KD","C","FP","M","SD","NYD"),
                               levels = c("V","S","MP","KD","C","FP","M","SD","NYD")),
                Number = c(21,113,25,16,22,19,84,47,2))

party.color.scale.color <- scale_color_manual(values = c("V" = "#b00000",
                                                       "S" = "#EE2020",
                                                       "MP" = "#80AA4E",
                                                       "SD" = "#fedf09",
                                                       "NYD" = "grey50",
                                                       "C" = "#39944A",
                                                       "FP" = "#0069b4",
                                                       "KD" = "#2D338E",
                                                       "M" = "#52bcec"),
                                            breaks = c("V","S","MP","KD","C","FP","M","SD","NYD"))

p <- ggparliament(d
                  ,party = Party
                  ,seats1 = Number
                  ,style = "dots"
                  ,label = "both"
                  ,size = 4
                  ,nrows = 10
                  ,total = 6
                  )
p <- p + theme_void() + theme(legend.title = element_blank())
p <- p + party.color.scale.color
p

Both color and seat number is correct. That was done by manually sorting the parties in d. Also, when I chose label = "both", the party names and seat number are mismatched.
Any suggestion how I can improve this?
Thanks again.

Solid filling

It's possible to make solid filling instead of points? How? Thanks a lot for this library!

Add JOSS Badge to README

Just noticed you don't have the JOSS badge on your README - it would be helpful if you could add the badge to link directly to the corresponding article:

DOI

Differing number of rows error

I am attempting to build an R app that pulls election data from my SQL database and creates visualizations using the ggparliament package. I have built in methods for filtering the data to one house-country-year dataframe, which has all of the necessary variables for running the parliament_data() function. However, when I attempt to run my dataframe through this function, I get the "Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 0, 435" message, which prevents me from successfully creating the dataframe needed to create the plot. I have tried dozens of different iterations, removing all extraneous columns and NA values, but for some reason I cannot seem to get past this issue.

This is a screenshot of the dataframe I am attempting to pass through the function. I have even tried formatting the column names and order to be identical to the examples, but the error persists.
image

Please let me know if anyone else has had a similar problem, or if there is a workaround I have not tried yet. Some of the code and the data are proprietary for my work so I cannot share everything but happy to provide some additional information if needed. Thank you!

Warning: Ignoring unknown aesthetics: type

I think this occurs because the type call in the aes isn't actually mapped to data. Aesthetics transform the data and type does not... It's really there so we don't have to specify type in the additional calls later on. I'm not really sure what to do here... Either we keep it as it is even though it's not really correct or we go back to defining the type in draw_majoritythreshold() and draw_partylabels()

Paper

Just chatted with my advisor and I spoke with Thomas ~1 month ago about writing an academic paper for ggparliament.
Places we can think about submitting to:

  • Legislative Studies Quarterly (Research note?)
  • Electoral Studies (Research note?)
  • Journal of Statistical Software (Long wait time...~2 years.)
  • Journal of Open Source Software (Quick turnaround, short pieces, not polisci-oriented.)
  • The Political Methodologist (This is really a newsletter for polmeth and isn't peer reviewed so it's more of a last resort IMO.)

I'm happy to do most (all?) of the legwork for this if you're not interested, @RobWHickman. Just throwing the idea out there. I'm not sure if you're interested in doing more academic work.

Error with colour data for 'australia'

I have just run through the updated 'ggparliament' version on GitHub (v2.1.0) and get the following error when running the example for Australia:
"Error: Unknown colour name: #F00011"

I have compared the data with the Cran version (v 2.0.0) and it appears to be the same but runs ok with no errors.

All the other countries. work. ok with the latest GitHub version , just not with the data for Australia.
cheers
M

geoms versus monolithic ggplot objects

I think we should consider breaking down ggparliament() into separate geoms.
This will give the user more flexibility over the final product and it should more like an extension to ggplot2 instead of a separate plotting system.
Moreover, breaking the monolithic functions into separate geoms gives us the opportunity to create additional functions for data preparation and scales for party colours.
The user will have the ability to pick and choose separate parts of the package AND they won't have to learn entirely new parameters as the ggplot2 syntax should be relatively familiar to them already. I'm proposing that we do the following (they are just examples and I'm open to change!):

  • geom_parliament_dots(aes(x=x,y=y,group=group), type=c('u-shape', 'hemicircle', 'bench'), ...)

  • geom_parliament_waffle()

  • geom_parliament_rose()

  • geom_parliament_arc()

  • geom_parliament_bar()

  • parliament_data(transform=c('dots', 'waffle', 'rose', 'arc', 'bar')

  • scale_colour_party(country="Australia")

  • scale_fill_party()

Minor issues to fix for next release

  • Opposing benches: X and Y columns should switch names.
  • Add size parameter for geom_emphasize_parliamentarians()... Or see if it can take the size of the previous call.

Issue in scale color manual 'limits' argument

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

Cleaning data

The .rda data in /data is a bit unclean- especially ward_results.

Here's a list of things to do (non-exhaustive)

  • Clean up ward_results so all columns are consistent
  • Clean up ward_results so passes travis build
  • Check colours for the German results
  • Generally make sure results are accurate
  • Add in 2018 data for ward_results

classroom parliaments flipped

(might be by design) the classroom parliaments look to me like the need to be flipped 90degrees to make a bit more sense?

Currently the largest party is on the right, but I assume the largest party at the front makes the most sense?

Will parliament_data work for long data sets?

Hmm, I'm curious to see if this will work. Say someone has a long list of every MP in parliament with their party affiliation, i.e. column 1 is name and column 2 is party....
Can we still use parliament_data() to find the x and y coordinates, providing they specify the row numbers and type? It might be something to look into and in theory should be easy to implement (famous last words, right?!) as the data doesn't need to expand, we just need to map the x and y coordinates to each parliamentarian.
Provided the user writes seats = NULL, or even seats = "long_format" in parliament_data(), we could then say if (object$seats == NULL / "long_format") { calc_coordinates ... } .

For example...

data <- data.frame(
name <- c(...),
party <- c(...)
)
seats <- parliament_data(type = 'semicircle', 
parl_rows = 8, 
seats = "long_format", 
election_data = data)

This should spit out the same data frame plus x, y, row, theta -- basically everything we get from calc_coordinates anyway. The user can then add whatever additional data they want, like colours, gender, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.