Git Product home page Git Product logo

Comments (4)

zmeers avatar zmeers commented on June 30, 2024

I think we need to revert back to the previous way of defining the parliament style in the draw_...() functions. It is unfortunate, but I think in the long run it will create more issues for us fixing a "bug" that has been sent to CRAN and other users receive warnings when they try to plot their ggparliament object. What do you think @RobWHickman ?

from ggparliament.

RobWHickman avatar RobWHickman commented on June 30, 2024

I wonder if there's a way to map the type of parliament onto the data. My brain is too fried at the moment to think of any other than an extra column of 'type' which is obviously a bad idea.

Otherwise, I wonder if the x/y positions of the 'seats' can imply the type? But I cant really think of a good way to do that either.

A final other option might be to kind of do what the original package did where the user calls a function that wraps ggplot() + geoms() + scales() + ... but again, seems suboptimal.

Think you might be right that going back to defining the type each line is the best way but something about it sets my teeth on edge

from ggparliament.

zmeers avatar zmeers commented on June 30, 2024

Another option is we get draw_...() to recognize where to print regardless of the type. For example, draw_totalseats() can be rewritten so the y coordinate for the total seats label is 25% of the height of y axis. Then we wouldn't need to specify y = 3 and y = 0.2 for horseshoe and semicircle parliaments, respectively.

The same goes for party labels - I wonder if we can move outwards from the last row using percentage points or unit points or whatever.

If you look at the majority threshold function, it kind of already works like this.. The opposing bench style finds the x and y coordinates for n, the majority threshold number, and draws a line between the the minimum value for x and the maximum value for x given that y is the same as the y coordinate for n.

I tried to figure out how to do this for horseshoe and semicircle but I kind of gave up, LOL. The main issue was that the minimum value for x,y start at (0,0) because the plot starts at that point instead of at (0, min(row 1 for majority threshold)). We should be able to find the point for n, then find the closest row 1 and the max row nearest to n, then draw a line from min(y coord for row) - 0.5 to max(y coord for row) + 0.5.

If we can solve that issue, the only problem is that the opposing bench line is horizontal, not vertical. But I've been thinking about switching that around anyway, so that one bench is on top and the other is below which would fix the problem. Or we can create a switch option here, where the user can switch between horizontal or vertical orientation... Which would be much better than defining by type every time, I agree.

from ggparliament.

RobWHickman avatar RobWHickman commented on June 30, 2024

yeah that makes sense. I think also might feed into changing the benches geom to being one plot rather than two patched together? I haven't interrogated patchwork, but I imagine drawing a line across two plots won't make it happy?

from ggparliament.

Related Issues (20)

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.