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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:22:23+00:00 2026-06-15T17:22:23+00:00

This isn’t, strictly speaking, a semilogy plot. I used this code to get a

  • 0

enter image description here

This isn’t, strictly speaking, a semilogy plot. I used this code to get a logarithmic y-axis:

pyplot.gca().set_yscale('log')

edit: Okay maybe I’m dumbing it down too much. I need to plot straight lines, from the x-axis at a 45 degree angle. Similar to the line in the image, but actually straight and at a 45 degree angle. I also need to shift any x-value based solely on its y-value.

What is the formula for plotting a straight line for known y-values and unknown x-values at a 45 degree angle? (Perhaps a math forum would be more appropriate?)

My education is at a pretty low level, so for instance I had to teach myself what logarithms are the other day because I had never learned in school. So I’m not able to work out a way to plot straight lines on my own.

  • 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-15T17:22:24+00:00Added an answer on June 15, 2026 at 5:22 pm

    Okay, just gonna answer the question with what I’ve figured out so far.

    In order to plot a straight line on a semilog, there are two main methods. If you have a list of x values and want to get the corresponding y values which will plot a straight line, then you just call numpy.exp() on each x value.

    import matplotlib.pyplot as plt
    import numpy as np
    
    plt.gca().set_yscale('log')
    
    x = np.arange(0, 51, 10)
    y = np.exp(x)
    
    plt.plot(x, y, 'k-')
    plt.show()
    

    Here’s some proof.

    enter image description here

    If you want to plot a straight line with known y values and unknown x values, just do the opposite.

    import matplotlib.pyplot as plt
    import numpy as np
    
    plt.gca().set_yscale('log')
    
    y = np.arange(0, 1001, 100)
    x = np.log(y)
    
    plt.plot(x, y, 'k-')
    plt.show()
    

    Here’s more proof.

    enter image description here

    Now, in the context of a skew-t, there’s more work to do. When generating a skew-t, you’ll need to work both from a known y-value and a known x-value. Here’s an example function which takes a temperature (x value) and a level (y value) and returns the appropriately skewed x value.

    def get_skewed_x(level, temp):
        base_log = (-30 * np.log(1000))
        top_log = (-30 * np.log(level))
        diff = base_log - temp
        x = top_log - diff
        return x
    

    The function accepts a level the data should be plotted on, and a temperature value.

    This function seems pretty complex, but that’s because when you create a straight line on a semilog by calling np.log() on a y-value, the x-value will be way off from where it needs to be. So you need to find the difference between where the value actually is, and where it should be. No matter what level you’re plotting the data at, you know where it should be plotted at the lowest level so you have to find the difference at the lowest level before applying it at the upper level.

    Once you know the "offset" you just compensate for that difference on all skewed x values. The reason these values are multiplied by -30 is application specific. This number will need to change based on the y limit and x limit of the plot.

    The "1000" in the np.log(1000) may need to change as well depending on the plot. This should be the lowest level on the skew-t plot (highest y value).

    The point is, if you know what temperature the data should be plotted on, and what level you want to plot the data, this function will properly skew the value (when the -30 is adjusted for your specific plot of course).

    To see the function in action, here’s what it looks like to plot a data point with a temperature of 10 at level 500.

    get_skewed_x(500, 10)
    

    The blue dot shows where the datapoint would be plotted.

    There’s probably a more elegant solution, but this is the best I have right now.

    enter image description here

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

Sidebar

Related Questions

This isn't strictly a programming question, but I'm asking it here because it's certainly
This isn't cross-platform code... everything is being performed on the same platform (i.e. endianess
This isn't a code question for once, but it definitely has me confused. Basically,
This isn't valid code: public class MyClass { private static boolean yesNo = false;
This isn't as malicious as it sounds, I want to get the current size
This isn't my code; I am trying to figure out what exactly this does.
This isn't working: $.ajax({url: PStoreZoomArea.php, type: get, data: {mapza: mapZoomArea, mapc: mapCenter, mapz: mapZoom}})
This isn't really related to a specific error; my code is not doing what
This isn't the complete code, but it's the parts that are causing problems. I've
This isn't my code, I'm just troubleshooting it. Some code that has been working

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.