Giter Site home page Giter Site logo

Comments (6)

pfitzseb avatar pfitzseb commented on August 25, 2024 1

This isn't a Juno specific issue:

λ j1 --quiet
julia> using Colors, ColorBrewer

julia> colors = ColorBrewer.palette("Set1", 9);

julia> show(stdout, MIME"image/svg+xml"(), colors)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
     width="180.0mm" height="25.0mm"
     shape-rendering="crispEdges">
<rect x="0.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#E41A1C" stroke="none" />
<rect x="20.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#377EB8" stroke="none" />
<rect x="40.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#4DAF4A" stroke="none" />
<rect x="60.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#984EA3" stroke="none" />
<rect x="80.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#FF7F00" stroke="none" />
<rect x="100.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#FFFF33" stroke="none" />
<rect x="120.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#A65628" stroke="none" />
<rect x="140.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#F781BF" stroke="none" />
<rect x="160.0mm" y="0.0mm"
      width="19.0mm" height="24.0mm"
      fill="#999999" stroke="none" />
</svg>6

julia> append!(colors, [colorant"white"])
ERROR: cannot resize array with shared data
Stacktrace:
 [1] _growend! at ./array.jl:814 [inlined]
 [2] append!(::Array{RGB{FixedPointNumbers.Normed{UInt8,8}},1}, ::Array{RGB{FixedPointNumbers.Normed{UInt8,8}},1}) at ./array.jl:897
 [3] top-level scope at none:0

from colors.jl.

timholy avatar timholy commented on August 25, 2024 1

I'd suggest transpose instead, since it doesn't prevent growth:

julia> a = [1,2]
2-element Array{Int64,1}:
 1
 2

julia> b = transpose(a)
1×2 LinearAlgebra.Transpose{Int64,Array{Int64,1}}:
 1  2

julia> push!(a, 3)
3-element Array{Int64,1}:
 1
 2
 3

Though I guess colors don't support transpose, so make that Base.ReshapedArray(colors, (1, length(colors)), ()).

PR welcome.

from colors.jl.

timholy avatar timholy commented on August 25, 2024

Won't change this without clearer justification: what's the error on Juno and why can't it be fixed within Juno?

from colors.jl.

kescobo avatar kescobo commented on August 25, 2024

@timholy sorry for the terseness and thanks @pfitzseb for jumping in. TBH I wasn't really sure what was going on, but wanted to plant the flag after discussing it on slack, since @pfitzseb said he couldn't get to it right away.

from colors.jl.

timholy avatar timholy commented on August 25, 2024

Want to try a pull request? The answer is right above you, just needs someone to push it over the finish line.

from colors.jl.

kescobo avatar kescobo commented on August 25, 2024

Sure! ☝️

from colors.jl.

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.