Giter VIP home page Giter VIP logo

Comments (8)

mkcor avatar mkcor commented on August 23, 2024

This looks like a duplicate of #154 ...

You cannot directly attach a CSV file here in the GitHub issue. Please upload it somewhere (in a GitHub repo, for instance) and share the link here. Or copy-paste the top of your dataframe.

from plotly.r.

cyruslentin avatar cyruslentin commented on August 23, 2024

Hi Marianne Corvellec,

Thanks for your response.

As had mentioned in 154, please close 154.
Please refer to file xfyFileData.csv given at https://github.com/cyruslentin/plotly.
With this csvs file, you will be able to run both the above mentioned codes easily.

As mentioned by you, have also tried

geom_point(aes(size=2, color="black")) in the plotly code. But results not good.

Regards -- Cyrus

from plotly.r.

cyruslentin avatar cyruslentin commented on August 23, 2024

Sorry wrong statement given above. Used the one given below

geom_point(aes(x=ShortMonth, y=CurrentMonth, group=FiscalYear, size=2, color="black")) +

No difference was seen in the output,

BTW, if the same change is made in the ggplot code then the black dots change to pink and an extra label is seen. Wonder why?

Any help will be appreciated.

from plotly.r.

mkcor avatar mkcor commented on August 23, 2024

Hello,

I think the error arises because ggplotly() is trying to merge the geom_line() and the geom_point() layers into one trace. I'll investigate and get back to you.

Thanks,
Marianne

from plotly.r.

mkcor avatar mkcor commented on August 23, 2024

Hello @cyruslentin !

On using color (colour) as an aesthetic of geom_point, as in

geom_point(aes(x=ShortMonth, y=CurrentMonth, group=FiscalYear, size=2, color="black"))

BTW, if the same change is made in the ggplot code then the black dots change to pink and an
extra label is seen. Wonder why?

This is a pure "ggplot2" question, which is not the scope of this project, so I'll refer you to the official "ggplot2" docs http://docs.ggplot2.org/0.9.3.1/geom_point.html (see second example) and http://docs.ggplot2.org/current/aes_group_order.html (see second example also).

It does not make sense to add a category of data that you would call "black". It gets represented in pink just because that's one of the levels in the default colour scale.

from plotly.r.

mkcor avatar mkcor commented on August 23, 2024

Hi again @cyruslentin

I suggest using the following code:

xfyDataPlot <- ggplot(data=fileData, aes(x=ShortMonth, y=CurrentMonth,
                                         label=CurrentMonth,
                                         group=FiscalYear)) +
  geom_line(aes(color=FiscalYear), size=1.1) +
  geom_point(size=2, color="black") +
  xlab("Month") + ylab("IIP Data")

This converts well into plotly:
566

It's almost exactly like your initial version, but I have moved the color aesthetic under geom_line(), which is where it belongs/applies only. If you leave the color aesthetic under ggplot(), it carries over to the geom_point layer, just like it does to the geom_point one. But this is not what you want or what you mean, since you want all your points to be black, you don't want them to reflect distinctions in the data.

The only imperfection you get (https://plot.ly/~marianne2/566/iip-data-vs-month/) is that you are missing the legend title somehow... Will open a specific issue for this.

Thanks for reporting!

from plotly.r.

cyruslentin avatar cyruslentin commented on August 23, 2024

HI Marianne,

Thanks for all your efforts & also a quick revert.

Further thanks for the detailed explanation on the "color (colour) as an aesthetic of geom_point" as well as cracking the issue. Legend Title not appearing - I guess one can live with that :)

Have incorporated the same in the code and checked; this works as is discussed.

Please treat this issue as closed. Though if there is any development on Legend Title please do let me know.

Regards -- Cyrus

from plotly.r.

mkcor avatar mkcor commented on August 23, 2024

You're welcome, Cyrus.

Great, please refer to #159 for any update on the missing legend title issue.

from plotly.r.

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.