FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Contours should be accessible for PointDensity charts · Issue #426 · plotly/Plotly.NET · GitHub

Contours should be accessible for PointDensity charts #426

Description

Description

I tried to combine two point density charts that share their coloraxis. For heatmaps this does not seems to be a problem, but for point density charts you have to (i) align the coloraxis, and (ii) set the contours individually.

Repro steps

code
#r "nuget: Plotly.NET.Interactive"

open Plotly.NET
open Plotly.NET.LayoutObjects
open Plotly.NET.TraceObjects
open Plotly.NET.StyleParam

let getZeroCollection n : float []=
    Array.zeroCreate n 

[
    Chart.PointDensity(
        x=(getZeroCollection 100),
        y=(getZeroCollection 100)
    ) 
    |> Chart.withColorAxisAnchor(1)

    Chart.PointDensity(
        x = (getZeroCollection 50),
        y = (getZeroCollection 50)
    ) 
    |> Chart.withColorAxisAnchor(1)
]
|> Chart.Grid(2,1)

The inner circle of the second chart has a point density of 50, but the color scale indicates 100.

Known workarounds

By setting the contour ranges for each plot individually and setting the ColorAxis to the same range, the combined plot is correct:

[
    Chart.PointDensity(
        x=(getZeroCollection 100),
        y=(getZeroCollection 100)
    ) 
    |> Chart.withColorAxisAnchor(1)
    |> GenericChart.mapiTrace (fun i t -> if i = 0 then t?contours <- (Contours.init(Start = 0, End = 100)); t else t)

    Chart.PointDensity(
        x = (getZeroCollection 50),
        y = (getZeroCollection 50)
    ) 
    |> Chart.withColorAxisAnchor(1)
    |> GenericChart.mapiTrace (fun i t -> if i = 0 then t?contours <- (Contours.init(Start = 0, End = 100)); t else t)
]
|> Chart.Grid(2,1)
|> Chart.withColorAxis(colorAxis=ColorAxis.init(CMin=0.,CMax=70.),Id=SubPlotId.ColorAxis 1)

Solution

  • The easiest solution is to add an option to either Chart.Grid or Chart.withLayoutStyle that enables to share the color axis for each density point chart.
  • If that is not possible, contours should be accessible from Chart.PointDensity()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL