If I have 10 values, each of which has a fitted value `F`

, and an upper and lower confidence interval `U`

and `L`

:

```
set.seed(0815)
F <- runif(10, 1, 2)
L <- runif(10, 0, 1)
U <- runif(10, 2, 3)
```

How can I show these 10 fitted values and their confidence intervals in the same plot like the one below in R?

Here is a plotrix solution:

```
set.seed(0815)
x <- 1:10
F <- runif(10,1,2)
L <- runif(10,0,1)
U <- runif(10,2,3)
require(plotrix)
plotCI(x, F, ui=U, li=L)
```

And here is a ggplot solution:

```
set.seed(0815)
df <- data.frame(x =1:10,
F =runif(10,1,2),
L =runif(10,0,1),
U =runif(10,2,3))
require(ggplot2)
ggplot(df, aes(x = x, y = F)) +
geom_point(size = 4) +
geom_errorbar(aes(ymax = U, ymin = L))
```

**UPDATE:**
Here is a base solution to your edits:

```
set.seed(1234)
x <- rnorm(20)
df <- data.frame(x = x,
y = x + rnorm(20))
plot(y ~ x, data = df)
# model
mod <- lm(y ~ x, data = df)
# predicts + interval
newx <- seq(min(df$x), max(df$x), length.out=100)
preds <- predict(mod, newdata = data.frame(x=newx),
interval = 'confidence')
# plot
plot(y ~ x, data = df, type = 'n')
# add fill
polygon(c(rev(newx), newx), c(rev(preds[ ,3]), preds[ ,2]), col = 'grey80', border = NA)
# model
abline(mod)
# intervals
lines(newx, preds[ ,3], lty = 'dashed', col = 'red')
lines(newx, preds[ ,2], lty = 'dashed', col = 'red')
```

- How to get AIC from Conwayâ€“Maxwell-Poisson regression via COM-poisson package in R?
- R : how to simply repeat a command?
- session not created: This version of ChromeDriver only supports Chrome version 74 error with ChromeDriver Chrome using Selenium
- How to show code but hide output in RMarkdown?
- remove kernel on jupyter notebook
- Function to calculate R2 (R-squared) in R
- Center Plot title in ggplot2
- R ggplot2: stat_count() must not be used with a y aesthetic error in Bar graph
- R multiple conditions in if statement
- What does "The following object is masked from 'package:xxx'" mean?
- Saving a high resolution image in R
- Change bar plot colour in geom_bar with ggplot2 in r
- Converting data frame column from character to numeric
- Extract Month and Year From Date in R
- How to combine two lists in R
- Extract year from date
- Ifelse statement in R with multiple conditions
- R dplyr: Drop multiple columns
- Remove legend ggplot 2.2
- Remove all of x axis labels in ggplot
- how to remove multiple columns in r dataframe?
- Aggregate multiple columns at once
- Changing fonts in ggplot2
- How to specify "does not contain" in dplyr filter
- how to use the Box-Cox power transformation in R
- Convert dataframe column to 1 or 0 for "true"/"false" values and assign to dataframe
- Having trouble setting working directory
- Coerce multiple columns to factors at once
- How to declare a vector of zeros in R
- Create empty data frame with column names by assigning a string vector?
- Explain ggplot2 warning: "Removed k rows containing missing values"
- R for loop skip to next iteration ifelse
- Error: package or namespace load failed for ggplot2 and for data.table
- How do I change the default library path for R packages
- Select first and last row from grouped data
- R * not meaningful for factors ERROR
- Error: could not find function "%>%"
- Raise to power in R
- In R, dealing with Error: ggplot2 doesn't know how to deal with data of class numeric
- Error - replacement has [x] rows, data has [y]
- Merge r brings error "'by' must specify uniquely valid columns"
- Non-numeric Argument to Binary Operator Error in R
- Convert row names into first column
- Append data frames together in a for loop
- Plotting with ggplot2: "Error: Discrete value supplied to continuous scale" on categorical y-axis
- R Markdown - changing font size and font type in html output
- Replace all occurrences of a string in a data frame
- How to convert dataframe into time series?
- Sum across multiple columns with dplyr
- Removing NA observations with dplyr::filter()
- [Move to How can I plot data with confidence intervals?]

- Fine control over the font size in Seaborn plots for academic papers
- Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python
- Modify the legend of pandas bar plot
- Format y axis as percent
- Simple line plots using seaborn
- Plot bar graph from Pandas DataFrame
- Plotting multiple lines, in different colors, with pandas dataframe
- Plotting in a non-blocking way with Matplotlib
- What does the error "arguments imply differing number of rows: x, y" mean?
- matplotlib get ylim values
- How to plot a function curve in R
- How to add title to subplots in Matplotlib?
- How to plot ROC curve in Python
- Change grid interval and specify tick labels in Matplotlib
- Reduce size of legend area in barplot
- Error in plot.new() : figure margins too large, Scatter plot
- Python how to plot graph sine wave
- Plot mean and standard deviation
- Code for best fit straight line of a scatter plot in python
- Plotting a list of (x, y) coordinates in python matplotlib
- Error in plot.window(...) : need finite 'xlim' values
- multiple plot in one figure in Python
- How to combine 2 plots (ggplot) into one plot?
- Adjust plot title (main) position
- Stacked Bar Plot in R
- how to draw directed graphs using networkx in python?
- Overlay normal curve to histogram in R
- Plot a line graph, error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ
- Plot Normal distribution with Matplotlib
- Plotting multiple time series on the same plot using ggplot()
- Add missing dates to pandas dataframe
- Adding a legend to PyPlot in Matplotlib in the simplest manner possible
- How to plot time series in python
- How to plot two columns of a pandas data frame using points?
- Create own colormap using matplotlib and plot color scale
- Colorplot of 2D array matplotlib
- R barplot Y-axis scale too short
- Plot a bar using matplotlib using a dictionary
- 3D Plotting from X, Y, Z Data, Excel or other Tools
- How to set xlim and ylim for a subplot in matplotlib
- How to export plots from matplotlib with transparent background?
- How can I make a "color map" plot in matlab?
- Set the intervals of x-axis using r
- Label points in geom_point
- Add error bars to show standard deviation on a plot in R
- Plotting of 1-dimensional Gaussian distribution function
- Plot multiple lines (data series) each with unique color in R
- How to change legend title in ggplot
- Plot multiple boxplot in one graph
- Increase distance between text and title on the y-axis
- [Move to How can I plot data with confidence intervals?]

- How do you create vectors with specific intervals in R?
- How can I plot data with confidence intervals?
- PHP: How can I determine if a variable has a value that is between two distinct constant values?
- Working with INTERVAL and CURDATE in MySQL
- How do I convert an interval into a number of hours with postgres?
- [Move to How can I plot data with confidence intervals?]