Insert horizontal error bars for a specific data point in a graph using R

After creating a graph with the following code:

plot(data.exoplanets$loga, data.exoplanets$logMass, ylab="Log of Mass", xlab="Log of Semi Major Axis")

I identified a specific point using:

points(data.exoplanets$loga[1535], data.exoplanets$logMass[1535], col="red", pch=19)

and then added vertical error bars based on KepError:

lines(rep(data.exoplanets$loga[1535],2), c(data.exoplanets$loga[1535]-KepError, data.exoplanets$loga[1535]+KepError), col="red", type="o", pch="_")

Now I am looking to modify this code to include horizontal error bars for the x-axis. Any suggestions?

Answer №1

Using the following code snippet will generate error bars along the x-axis:

lines(c(data.exoplanets$loga[1535]-xerr,data.exoplanets$loga[1535]+xerr),
rep(data.exoplanets$logMass[1535],2), col="red", type="o", pch="|")

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Personalize Material design slider Label - final element

When using Material-ui, the default position of Slider's labels is centered: However, I require the labels to have a space-between position. For example: To achieve this, I tried using the '&:last-child' property for the markLabel clas ...

Manipulating the state of the <audio> HTML5 element with Javascript

Are there any Javascript methods available to retrieve information about the current state of an audio tag? For example: Is the audio playing? Has it stopped? Is it muted? Is it paused? I am aware of using play(), pause(), and others, but I'm unsure ...

Tips for incorporating a raster and polygon dataset into a single map with distinct fill styling

My goal is to create a map that displays ocean bathymetry along with colored polygons filled by a specific variable (each Region in a different color). Despite trying various packages and approaches, I am facing difficulties in coloring/filling the polygon ...

What's the name of the auto-triggered dropdown menu feature?

Visit Amazon's official website Description: Within the 'Shop by Department' section- A drop-down menu that remains visible without requiring you to hover over it. However, when the browser is in a non-full-screen mode, the menu disappears ...

Numerous column pictures that occupy the entire browser screen

I am looking to create a grid of clickable images that expand to cover the width of the browser window without any space on either side. Ideally, I would like each image to be 180x180px in size, but if it's easier they can resize based on the browser ...

What is the best way to center text within a button when there is also an image present?

I'm trying to create a button with an image and some text, but I can't seem to get it aligned properly. Here's the code I have so far: <button><img src="https://www.google.com/s2/favicons?domain=google.com">&nbsp;Go ...

HyperText Markup Language, Cascading Style Sheets, and JavaScript

In my div, I have a combination of icons and text. I'm trying to center only the text within the div, with two icons on the left and 4 to 5 icons on the right. Although I managed to position the icons correctly, I am having trouble aligning the text ...

Header Customization and Post Layout on Tumblr

In my recent purchase, I acquired the Margaret Studio theme from themecloset on Tumblr. Upon adding my own logo, it unexpectedly resulted in the first image on my blog being cut off with a white strip that seems to be the 'background' of my logo ...

Bootstrap navbar failing to be responsive - collapses instantly

Currently, I am in the process of developing a MEAN stack application and using Bootstrap for styling purposes. While working on the project, I made some modifications by adding routing and ngIf statements. But now, I have encountered an issue where the na ...

What are some ways to create an opaque effect for a DIV element

I've set up a div on the top of my website that spans 100% width and is in an absolute and fixed position. The code for it looks like this: div.header{ height: 60px; width: 100%; position: absolute; position: fixed; top: 0px; ...

What steps can I take to avoid horizontal scrolling on mobile due to a table overflowing?

My website displays a table within a bootstrap container, row, and column. While everything looks good on larger screens, the content within the table is causing a horizontal scroll on smaller screens, making the footer look distorted. This results in a me ...

Utilizing R and Weather Underground: Discovering the Nearest Airport Station Using Longitude and Latitude

Is there a way to locate the closest Airport station using longitude and latitude coordinates? Suppose I have this json data stored in my database: "location" : { "long" : "Devon, 8 Market Road, Plympton, Plymouth PL7 1QW, United Kingdom", "stre ...

Failure to Link Different Files Using HTML Links

Organizing the different pages of my website, I initially stored HTML files in a folder called X, with index.html, main.html, and other pages. To streamline access, I decided to separate the articles into folders A, B, and C within folder X. However, this ...

Unable to retrieve the DOM element using jQuery

I'm currently facing an issue with fetching a DOM element from a jQuery selector array. var index = $(this).index(); $titleElement = $(".title:not(.small)")[index]; Unfortunately, the code above only gives me the text and not the actual DOM element ...

Text area with a set height and expandable max-height - scrollable overflow

http://codepen.io/africanmatt/pen/IcGpa .text { max-height: 0; overflow-y: auto; transition: all .45s ease-in-out; } .text-active { max-height: 50%; } I am looking for a way to resize the .text component's max-height so that it adjusts prop ...

Bootstrap navbar does not appear on smaller devices due to a display issue

This particular navigation bar, featuring a logo image in the center, functions well on larger screens. However, when viewed on smaller screens, everything disappears, including the logo image, and the hamburger menu icon fails to display. Is there a solut ...

The image fails to reach full width and does not expand correctly when I zoom out

At the bottom of my website, I have a bar for displaying certain content. However, I am facing an issue where the bar is not extending to cover the entire screen width despite having code in place to do so. The HTML code is quite basic: <div class="bo ...

Modal box fails to refresh content

Currently, I am in the process of learning how to modify my blog using a modal window. However, when I click on the edit button within the modal, an error message 'Failed to execute 'fetch' on 'Window': Invalid name' appears i ...

What could be the reason for my Angular Material CSS file not functioning correctly?

After creating an HTML file using Angular Material, I noticed that the components' CSS files are not being applied properly. This is a snippet from my HTML file: <div class="content-container"> <div class="tree-container&quo ...

Display a PDF in a <div> when the menu is clicked

I have a project where I am trying to load a PDF in the middle of my page, inside a div, upon clicking on buttons in a side menu located on the left. While I have been successful in loading the PDF in the div, I am facing issues with triggering this action ...