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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:37:37+00:00 2026-05-25T17:37:37+00:00

I have 3 dimensions that I want to plot, and I want the third

  • 0

I have 3 dimensions that I want to plot, and I want the third dimension to be color.

This will be in R by the way. For instance, my data looks like this

x = [1,2,3,4,1,5,6,3,4,7,8,9]
y = [45,32,67,32,32,47,89,91,10,12,43,27]
z = [1,2,3,4,5,6,7,8,9,10,11,12]

I am trying to use filled.contour, but it giving me an error saying x and y must be in increasing order. But I’m not really sure how to arrange my data such that that is true. Because if I arrange x in increasing order, then y will not be in increasing order.

It is also feasible for me to do a non-filled contour method where it is just data points that are colored. How can I do this in R. Any suggested packages? Please use specific examples. 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-25T17:37:37+00:00Added an answer on May 25, 2026 at 5:37 pm
    jet.colors <-
       colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",
                          "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))
    plot(x,y, col=jet.colors(12)[z], ylim=c(0,100), pch=20, cex=2)
    legend(8.5,90, col = jet.colors(12)[z], legend=z, pch=15)
    

    And if you want to check the coloring you can label the points with the z value:

    text(x, y+2, labels=z)  #offset vertically to see the colors
    

    enter image description here

    Another option is to use package:akima which does interpolations on irregular (non)-grids:

    require(akima)
    require(lattice)
    ak.interp <- interp(x,y,z)
    pdf(file="out.pdf")
    levelplot(ak.interp$z, main="Output of akima plotted with lattice::levelplot", contour=TRUE)
     dev.off()
    

    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 this wonderful iFrame that has wonkey dimensions that I want to change
I have three functions in spherical coordinates that I want to plot. They are
I want to have something like this below: template <class T> struct Container{ public:
I have and I want that div has the same dimensions as the width
I have an Nx4 array of vertices that I'd like to plot using glVertexArray
I have a three-dimensional array that I want to reset to zero. It seems
I have an multi-dimensional array that I want to send to a PHP script
I have two div elements that are twins (i.e. their dimensions and contents are
Background I have a dimension table that has a single record for each day.
I have a picture that I need to resize to a specific dimension and

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.