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 7605119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:05:10+00:00 2026-05-31T00:05:10+00:00

I am plotting a raster image from the data stored in a file by

  • 0

I am plotting a raster image from the data stored in a file by using the three lines of code given below. However, I wish to generate a legend (or color-chart) below the image. The default legend is generated on the right hand side. Any idea how I may get legend at desired location.
Secondly, I am getting a rectangle around the image which I don’t require in the final plot. Please help me with these issues.

            temp_var<-raster(input)
    par(mar=c(0,0,0,0))
    plot(temp_var,legend=F,axes=FALSE)

Thanks…

  • 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-05-31T00:05:12+00:00Added an answer on May 31, 2026 at 12:05 am

    I have fought with the rectangle in plot() method for Raster* objects. I am sure there is a way to get rid of it, but you don’t need to. I have always used this workaround:

    image(temp_var, axes=FALSE, xlab="", ylab="")
    

    As for your legend, I believe you will have to build that manually to your specs. Try:

    layout(matrix(c(1,1,1,1,1,2,2), 7, 1))
    par(mar=c(0,0,0,0))
    image(temp_var, axes=FALSE, xlab="", ylab="")
    plot(c(0,1), c(0,1), type="n", xlab="", ylab="", axes=FALSE)
    legend(0.1,0.9, legend=c(1:5), fill=rainbow(5), horiz=TRUE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am Plotting a pixel on the screen from the following code using Assembly
I am plotting a confusion matrix with matplotlib with the following code: from numpy
I'm using rpy2 to do data analysis and plotting in python. It works fine
When plotting multiple data series using both line specification ( X , Y ,
When plotting surfaces using mpl_toolkits.mplot3d.Axes3D.plot_surface() , lines appear that seem to follow the curve
when plotting my data using gnuplot, I experience that the right border is cut
I am thinking of using wxMathPlot for plotting/graphing some data that arrives continuously. I
I'm creating some maps from raster files using the raster package in R. I'd
I am plotting a 7x7 pixel 'image' in MATLAB, using the imagesc command: imagesc(conf_matrix,
I'm plotting data which extent, in x, from -1000 to 1000. But I'm only

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.