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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:59:52+00:00 2026-06-04T13:59:52+00:00

I have a question regarding a weird result for a line plot that uses

  • 0

I have a question regarding a weird result for a line plot that uses facets.
I have water data masurements for different depth (=pressures). The data comes as a table as such:

Pressure Temperature pH
0        30          8.1
1        28          8.0

I “melt” this data to yield:

Pressure variable    value
0        Temperature 30
1        Temperature 30
0        pH          8.1
1        pH          8.0

and so on. I now plot this:

ggplot(data.m.df, aes(x=value, y=Pressure)) +
  facet_grid(.~variable, scale = "free") +
  scale_y_reverse() +
  geom_line() +
  opts(axis.title.x=theme_blank())

It kinda works, except there are parts of the line plot that get filled with solid color. I have no idea why, especially because it works just fine if I exchange x for y and use “variable ~ .” as the facet_grid formula.
weird plot

  • 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-04T13:59:54+00:00Added an answer on June 4, 2026 at 1:59 pm

    Note the difference between geom_line and geom_path applied to the same data.

    library(ggplot2)
    
    x = c(seq(1, 10, 1), seq(10, 1, -1))
    y = seq(0, 19, 1)
    df = data.frame(x, y)
    
    ggplot(df, aes(x, y)) + geom_line()
    ggplot(df, aes(x, y)) + geom_path() 
    

    enter image description here

    Note the order in the df data frame.

        x  y
    1   1  0
    2   2  1
    3   3  2
    4   4  3
    5   5  4
    6   6  5
    7   7  6
    8   8  7
    9   9  8
    10 10  9
    11 10 10
    12  9 11
    13  8 12
    14  7 13
    15  6 14
    16  5 15
    17  4 16
    18  3 17
    19  2 18
    20  1 19
    

    geom_path plots in order of the observations.

    geom_line plots in order of x values.

    The effect is more marked when the x values are closer together.

    x = c(seq(1, 10, .01), seq(10, 1, -.01))
    y = seq(.99, 19, .01)
    df = data.frame(x, y)
    
    ggplot(df, aes(x, y)) + geom_line() 
    ggplot(df, aes(x, y)) + geom_path()
    

    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 question regarding static function in php. let's assume that I have
I have a question regarding jQuery. I have multiple images that are, in essence,
I have a question regarding class design. I want to have a class that
I have question regarding the storage of large amount of data. The situation is
I would have question regarding web services. Let's say I have webservice client that
I have question regarding the SQLAlchemy. How can I add into my mapped class
I have question regarding the use of function parameters. In the past I have
I have question regarding disabling browser caching. I have already found few solutions, and
I have a question regarding dependency injection. say i want to create a class
I have a question regarding the onkeypress event on JavaScript. Is it possible 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.