Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8745197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:58:03+00:00 2026-06-13T11:58:03+00:00

I generate the legend in my ggplot2 plot with scale_colour_discrete(name=textCF) I like that i

  • 0

I generate the legend in my ggplot2 plot with

scale_colour_discrete(name=textCF)

I like that i can see which colour belongs to which value, but it consumes to much space in the plot.

legend does not fit

I tried also the scale_colour_gradientn scheme, but this is so condensed, that i can not distiguish the values anymore. If i could only change the width of this colourbar.

scale_colour_gradientn(name=textCF,colours = rainbow(nrow(mydf), start=2/6), breaks=round(mydf$CF)) +

ticks are to close

How can I improve the lookout?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:58:04+00:00Added an answer on June 13, 2026 at 11:58 am

    The size of a colourbar can be controlled with the barwidth and barheight parameters.

    Start with a reproducible example to see the effects:

    ggplot(mtcars, aes(x=wt, y=mpg, colour=qsec)) +
      geom_point() +
      scale_colour_gradient() +
      theme(legend.position = "bottom")
    

    I’m using scale_colour_gradient, but this works in general.

    You control aspects of the guide with the guide argument to a scale. See the help on guide_colourbar for all the parameters that you can set.

    ggplot(mtcars, aes(x=wt, y=mpg, colour=qsec)) +
      geom_point() +
      scale_colour_gradient(guide = guide_colourbar(barwidth=20, barheight=2)) +
      theme(legend.position = "bottom")
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a legend with 4 different entries that I would like to arrange
Hi can I add an additional legend to a ggplot. Like the following code
I would like to merge vectors of Latin and Greek text to generate plot
To generate the following markup: <label class=foo>Bar</label> The PHP will look something like: <?php
I generate EMMA reports during my build, they look like this <report> <stats> <packages
I've created a simple scatter plot in R with specific RGB color values like
I am using reportlab to generate a LinePlot chart. I can't seem to get
form: <form id=defineForm method=POST action=api/test> <fieldset> <legend>Generale</legend> <input type=text name=id size=60 maxlength=60/> <input type=text
I am trying to add geom_text labels to my mosaic plot below: that I
I created this plot with ggplot2 : The outside lines need to correspond to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.