JuliaPlots/Plots.jl

PlotlyJS shape series does not respect line attributes if markerstrokewidth == 0

Open

#4,603 创建于 2022年12月15日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Julia (1,943 star) (381 fork)batch import
PlotlyPlotlyJSbuggood first issue

描述

The border for bars in histograms (and shape series, more generally) is controlled by line* attributes, but these seem to be ignored for backend Plotly/PlotlyJS if markerstrokewidth is set to 0.

Example:

using Plots, Random, Distributions
x = rand(Normal(), 100)

gr()
histogram(x, linecolor=:red, markerstrokewidth=0)
# Bars are outlined in red, as expected

histogram(x, linewidth=0, markerstrokewidth=0)
# No border, slight gaps between some bars (expected)

import PlotlyJS
plotlyjs()
histogram(x, linecolor=:red, markerstrokewidth=0)
# Bars are outlined in various colors

histogram(x, linewidth=0, markerstrokewidth=0)
# Bars are still outlined in various colors

This seems to be due to the conditional here: https://github.com/JuliaPlots/Plots.jl/blob/a21d2ad0c6378f99e9b7fa76c1d852c87b08b9a8/src/backends/plotly.jl#L770 which, as far as I can tell, doesn't have an analog in the other backends.

Can this conditional be safely removed (i.e., always set :color, :width, and :dash in plotattributes_out using lines 771-777), or would that break something else?

贡献者指南