Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AxisAnchor AxisReference #55

Open
schlichtanders opened this issue Jan 15, 2019 · 4 comments
Open

AxisAnchor AxisReference #55

schlichtanders opened this issue Jan 15, 2019 · 4 comments

Comments

@schlichtanders
Copy link

the current AxisAnchor / AxisReference implementation looks unnecessarily limited.
Putting both together, currently the only options for axisanchor are "x", "x1", ..., "x3", "y", ..., "y4", "free"

for instance there can only 5 subplots right now

Maybe this is a plotly limitation, I don't know, but if not, please consider taking off this limiting factor of subplots.

@schlichtanders
Copy link
Author

again run into this problem that the number of subplots is limited by having this sealed abstract class AxisReference with only a couple of instances.

is there a need to make this sealed?

look for instance https://plot.ly/python/subplots/#multiple-custom-sized-subplots
there they use at least up to x6,y6

the syntax definitely suggest that it should seamlessly work for arbitrary many AxisReferences

Please, any comment is highly apprecitated
(I am currently thinking about writing my own thinner plotly.js wrapper which does not have such restrictions)

@sbrunk
Copy link
Collaborator

sbrunk commented Feb 8, 2019

The current restriction might just be for historical reasons because plotly upstream is constantly evolving (I haven't checked though).

Do you want to look into it and perhaps create a PR with a more generic solution for AxisAnchor and AxisReference instead of creating your own wrapper?

@schlichtanders
Copy link
Author

This is unfortunately not trivial because the AxisReference is interpreted as Enum

implicit val axisAnchorIsEnum = IsEnum.instance[AxisAnchor](_.label)
implicit val axisReferenceIsEnum = IsEnum.instance[AxisReference](_.label)

However, I would need a plain String...
Haven't worked with Argonaut yet

@schlichtanders
Copy link
Author

schlichtanders commented Feb 11, 2019

for those who stumble upon this and need a quick solution from scala:

  • use import shapeless.record._ and val trace = Record(x = Seq(1,2,3,5), y = Seq(1,3,14), name = "title", `type` = "scatter")
  • together with import io.circe.shapes._ circe can transform arbitrary Record to the correct json string
  • paste everything together in your custom plotly html file

super tiny, but with this you can already access all plotly features however recent they may be

Remarks on Type Support:

  • this will give you type support in the sense of that you can still access types correctly,
  • however this won't give you type support in the sense that if you use a wrong attribute name or attribute type, things will break only at html/javascript level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants