• How to recolor a graph line?

    Author
    Topic
    #2281792

    Not sure if this or the Tools subforum is the right place for this question, but here goes…

    I would like simple instructions on how to change the color of a plot line in a screenshot of a graph, preferably using free software (for either Windows or Kubuntu Linux). As an example, consider the graph below:
    Color-graph

    [Source]

    Suppose that I wanted to change the orange plot to green, and the blue plot to red. Is there a simple way to do that in any free graphics software? Microsoft Paint can’t do it. In Linux, I’ve tried GIMP, Krita, and Dia, but I’ve looked at their user manuals and it’s totally disproportionate to go through a graduate-level course in graphics jargon–“layers” and “filters” and “masks,” oh my!–to do what seemingly should be a straightforward procedure that I only need to do once in a blue moon. (Meaning, by the next time I’d have to do this, I would have forgotten the details of the user-manual dissertation and would have to review it all over again.)

    I’ve also come across YouTube videos that claim to show you how to do this, but for heaven’s sakes they’re like multi-part, half-hour episodes.

    Hoping for a step-by-step description in a program that I can use. It really shouldn’t have to be that hard to tell a program to just select the blue plot line and change it to red.

     

    • This topic was modified 4 years, 10 months ago by Cybertooth.
    • This topic was modified 4 years, 10 months ago by Cybertooth.
    • This topic was modified 4 years, 10 months ago by Cybertooth.
    Viewing 6 reply threads
    Author
    Replies
    • #2281799

      Easiest way is to just draw a new line on top of the old one, the color and width that will cover the old line.

      On PicPick, you can then click to ‘flatten’ the line… and it appears recolored…

      I like using masks, and all that, but I understand the learning curve!

      Color-graph-128x72-1

      Non-techy Win 10 Pro and Linux Mint experimenter

      1 user thanked author for this post.
      • #2281802

        Sorry… did this quick and dirty, and the original image was too small… and I didn’t take care when enlarging… but I think it illustrates what you can do.

        Non-techy Win 10 Pro and Linux Mint experimenter

        1 user thanked author for this post.
    • #2281803

      Thanks @Elly, I will explore this application.

      If the plot line were curved instead of straight, such that it would be difficult to trace over it exactly, what would you do to recolor the line?

       

    • #2281961

      I was going to suggest using any old paint program to flood-fill the colour you want to change, but as (in your example) the orange is a range of colours, that won’t work.

      Color-graph-crop-x500
      Now how do I blow that up – or will the system do it for me?  <re-submitted with scaled up vn> Of course, you know the answer is to obtain the source (in Excel, LO-calc etc).  Given that range of colours, and the line crossing the ‘blobs’, its a non-trivial exercise for a machine.

      2 users thanked author for this post.
    • #2281990

      You might be able to make a slightly thicker line to cover the first line.

      On permanent hiatus {with backup and coffee}
      offline▸ Win10Pro 2004.19041.572 x64 i3-3220 RAM8GB HDD Firefox83.0b3 WindowsDefender
      offline▸ Acer TravelMate P215-52 RAM8GB Win11Pro 22H2.22621.1265 x64 i5-10210U SSD Firefox106.0 MicrosoftDefender
      online▸ Win11Pro 22H2.22621.1992 x64 i5-9400 RAM16GB HDD Firefox116.0b3 MicrosoftDefender
      1 user thanked author for this post.
      • #2281998

        OK, now let’s make this a bit harder.  🙂

        Suppose that a plot line is wavy or curved, such that it’s virtually impossible to trace a new line of a different color exactly over it. How then might one change its color?

        In GIMP (Linux), I’ve managed to select a plot line. I know (OK, I believe) it’s selected because there’s a dotted-line animation coursing around its edges. But for the life of me I can’t find any way to tell GIMP how to change the color of that selection (only). multiple Web searches haven’t turned up any useful answers that don’t involve spending months learning how to use the software.

         

        • This reply was modified 4 years, 10 months ago by Cybertooth.
        • #2282010

          Create a second layer, and import the original picture again. (You are working on a copy of the original, maybe… hopefully?)

          In the first layer, crop that selection you’ve made.. then you can make changes within it… save as a layer.

          Under Layer/Stack move the order of layers so that the changed one is on top.

          Under edit Select All… then under File, Export it to the format you desire.

          Non-techy Win 10 Pro and Linux Mint experimenter

          • This reply was modified 4 years, 10 months ago by Elly.
        • #2282021

          Gimp is the wrong program to do this as it draws using raster. (non data based line)
          You need a vector graphics based program (data info withing the line) and the free one in linux is inkscape. (Also available for Windows see portable apps)

          Once you have inkscape installed, you will need to import the pdf/jpeg or png,
          Then use the curve tools to create the curvature you require with your preferred color either over the top of the existing or anew.

          Once done, export the whole graphic to your preferrred output, pdf/ jpg or png.
          Remember to save your work in inkscape so, if you want to change the color of the curve in the future, you can by selecting it within inkscape and using the color palate, change it and export again.

          Windows - commercial by definition and now function...
          2 users thanked author for this post.
    • #2282004

      I don’t know how to make a curved line change without going into layers, cropping, making a color change, then combining the layers with the changed one on top… in Gimp… and assuming you are working with a .png or .jpg.

      Which brings me to the question- what source are you using? Are you talking about just making changes to graphs? Wouldn’t it be easier to create a new graph with the line colors you desire?

      Changing just a particular color within a picture gets messy, because you will see that the same color is used in pixels elsewhere, and/or there are multiple colored pixels that create what you see as orange, or gray, or black. which is why you’d create a separate layer, remove everything except what you want to change, change those, then save the two layers together, with the changed one on top.

      If you want to emphasize a particular line or curve, wouldn’t it be easier to just use something that highlights it, as if you were taking a yellow highlighter to it, or circle with a red pen?

      Just throwing out multiple ideas…

      Non-techy Win 10 Pro and Linux Mint experimenter

      1 user thanked author for this post.
      • #2282048

        @Elly, thanks for the ideas.

        I was hoping simply to invert the colors on a graph that contains two plot lines, to change the emphasis from one plot to the other. This was from a screenshot off a website.

        Creating a new graph from scratch so as to apply the desired colors would require access to the data used in the graph’s creation, and putting it together would be a heck of a lot more trouble that it’s worth even if the data were accessible.

        I could draw a big red arrow toward the plot line to which I wish to draw attention, but then the other one would still be darker across the whole chart.

        I’m giving up on the whole idea, but I appreciate the suggestions.

        1 user thanked author for this post.
    • #2282156

      OK – I may have an answer (or rather, Irfan Skiljan does): open the image in IrfanView (the best free picture viewer I know), and click Image>Replace colour:

      colour-swap-1
      Select your original (orangey) in the main image with a left click, then select new colour (‘Choose’ offers a palette), then click ‘Apply’.  You may not see much change, as only the colours that exactly match your line-click will change – so then try increasing the ‘Tolerance’ until you get more effect – I have never used this feature before, so it just goes to show what treasures the program contains.  This is the final image, after I used a tolerance of 60 (I’ve no idea what that meant, it was wait-it-and-see):

      Color-graph-swap-zoom
      I can’t tell what these two images will look like until I submit, so here’s hoping!  Good luck, Martin.

      <Edited to add that I’m rather pleased with myself after that, although we all know whom to thank>

      • This reply was modified 4 years, 10 months ago by mngerhold.
      • This reply was modified 4 years, 10 months ago by mngerhold.
      • This reply was modified 4 years, 10 months ago by mngerhold.
      2 users thanked author for this post.
    • #2282282

      Well, learning something new, every day… and those instructions are simple and clear… should be easy to follow, and do not require layers… Nice!

      Non-techy Win 10 Pro and Linux Mint experimenter

      1 user thanked author for this post.
    Viewing 6 reply threads
    Reply To: How to recolor a graph line?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: