Questions tagged [lattice]

lattice is a package that forms part of base R and allows the creation of trellis-type graphics.

lattice
Filter by
Sorted by
Tagged with
1 vote
0 answers
90 views

Overlap of axis labels

I am conducting a multi level regression model where I look at how house prices vary based on the number of rooms with my level 2 predictor being districts. When I plot the residuals using the dotplot(...
1 vote
2 answers
112 views

Asking for ideas to plot large variables against their R squared values (drawn from linear regression models) in R (preferably using GGPLOT2)

I had to build 231 linear regression models for my project. After running 231 models, I am left with 231 R squared values that I have to present in a plot against the variable names. Since 231 R ...
0 votes
2 answers
174 views

How can I make multiplot in R

I have this dataset, I want to make triple y axis where "Country" will be X axis. in the y axis I want to do two clustered column with one line graph overlapping. I am a new user, learning ...
6 votes
3 answers
3k views

How to get shaded background in xyplot in R?

using xyplot from the lattice package, I plot a time series over a number of years. I would to add a shaded area for some of these years to indicate that this time period was "special" (e.g. war). ...
2 votes
2 answers
1k views

Trying to find a way to combine IRT info plots from 3 different mirt models in R in the same

I am looking to combine all three" test information function" lines (one for each model) into one and the same graph. I have a data set of category 1-5 Likert responses in 400 rows in sets of 8 ...
0 votes
1 answer
115 views

Is there a way I could reproduce the box plots using the lattice package function bwplot()

par(mai = c(1, 1, 1, 1), omi = c(0, 0, 0, 0)) set.seed(591) (xx1 <- rnorm(20, mean = 3, sd = 3.6)) (xx2 <- rpois(40, lambda = 3.5)) (xx3 <- rchisq(31, df = 5, ncp = 0)) box plot code using ...
0 votes
1 answer
90 views

show value on lattice dotplot

I have a dot plot: Done using lattice dotplot() of my resamples() list. How do I display the values of each plot? (my code is just dotplot(resamples(list())).
0 votes
1 answer
777 views

HH package in R: Border around key in likert() plots

I'm plotting some Likert data as diverging stacked barcharts, but I can't figure out how to draw borders around the keys in the legend in auto.key (showing colors for each Likert item); HH is based on ...
1 vote
1 answer
491 views

What is the most efficient method to plot large Adjacency Matrices (not Graphs)?

I am searching an efficient way to plot large Adjacency Matrices (>1M nodes) in R. The aim is not to plot them as a Network Graph but to plot the Adjacency Matrix itself. This is quite a common ...
1 vote
1 answer
369 views

How to add mean to grouped bwplot Lattice R

I have a grouped boxplot that shows for each category two boxes side by side (see code). Now I am interested in adding the mean for each category and box separately. I can calculate and visualize the ...
0 votes
1 answer
333 views

Barplot for several categorical variables divided by one categorical variable in R

I would like to visualize how a categorical variable varies for several other categorical variables. My data looks like this Species Class species2 1 setosa 1 0 2 setosa 1 ...
0 votes
1 answer
246 views

How to change labels inside a density plot to a legend on the side?

I have a RasterStack with several 400MB raster files and I want to compare them among each other with the rasterVIS density function. The problem is that the labels of the plot overlap each other. ...
0 votes
2 answers
414 views

R - add circles to existing time-series plot

I am trying to add a circle to a specific position of a lattice time-series xyplot. The plot that I have is: library(zoo) library(lattice) t <- structure(list(date = structure(c(18172, 18177, ...
0 votes
1 answer
450 views

How can you create Marginal Histogram Scatterplot using lattice package (not ggplot2)?

Long story short, I am working on an assignment for a data visualization course and the assignment specifies that we have to use the lattice package and that we have to create a marginal histogram ...
1 vote
1 answer
58 views

R lattice -- unexpected legend

I want to graphically compare carbon pools under different forms of land use. I am reading in my data, later I remove a factor level. However, when I display the data the legend does not work. The ...
9 votes
3 answers
3k views

Symmetrical, violin plot-like histogram?

How can I make a histogram in which the center of each bar lies along a common axis? This would look like a violin plot with step-shaped edges. I'd like to do this in Lattice, and don't mind ...
3 votes
2 answers
1k views

Force lattice to use a label for all axis ticks

I am generating a plot with xyplot from the lattice package. I use the following command: xyplot(Y ~ X | Bench, dt, type = 'o') And this is the result: On the Y axis there is a tick without label (...
29 votes
4 answers
75k views

How to add boxplots to scatterplot with jitter

I am using following commands to produce a scatterplot with jitter: ddf = data.frame(NUMS = rnorm(500), GRP = sample(LETTERS[1:5],500,replace=T)) library(lattice) stripplot(NUMS~GRP,data=ddf, jitter....
4 votes
1 answer
406 views

R Lattice: Removing the wireframe mesh

I am currently trying to construct a simple wireframe plot from the lattice package, but consisting of several hundred points along the y axis. This leads to the plot being swamped by the wireframe ...
1 vote
1 answer
2k views

Python, NetworkX hexagonal lattice problem - how to create a perfect lattice?

So I am trying to generate a hexagonal lattice using NetworkX in Python. After using code: G = nx.hexagonal_lattice_graph(m=2, n=2, periodic=False, with_positions=True, create_using=None) plt.subplot(...
0 votes
1 answer
337 views

Unused argument in layer_

I am trying to reproduce the following here: https://www.r-graph-gallery.com/201-levelplot-with-latticeextra.html # library library(latticeExtra) # create data set.seed(1) data <- data.frame(x =...
2 votes
1 answer
503 views

removing the ticks on the 3rd and 4th axes in plots from library effects in R

I'm wondering if there is a way to remove the tickmarks (the axes) on the 3rd and 4th axes of the plot generated by library effects as shown below? library(effects) m <- lm(Fertility ~ ., data = ...
4 votes
1 answer
2k views

Lattice dotplot conditional fill color

Problem: I have a data frame, which I want to visualize with lattice's panel dot plot (not ggplot2). It contains a variable which should be used conditionally to highlight data by different color ...
1 vote
2 answers
488 views

rasterVis - setting the bottom plots in the middle with levelplot

I am using the awesome rasterVis to create a panel with maps that have the same extent (i.e. same spatial coverage) but that show different features (i.e. each with its own legend). This is what it ...
1 vote
1 answer
136 views

Conditioning on two variables in Lattice

This is the data frame I'm working with: datal2<- structure(list(id = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L), .Label = c("49180", "75725", "88743", "172231"),...
2 votes
1 answer
139 views

Adding correlation figures in xyplot panels in R

All -- is there a way to put the correlation figures inside the xyplot charts? I can do it using plot, e.g. with(iris, plot(Sepal.Length, Petal.Length, pch=16), cex=1, main="Length: Sepal vs. ...
3 votes
1 answer
2k views

Add vertical lines to Seaborn Facet Grid plots based on the occurrence of an event

I have panel data with 50 different individuals over 60 months. I've created facet grids using Seaborn to plot the tone for each individual over time and now want to add vertical lines for when an ...
0 votes
0 answers
45 views

Is there a way to customly define a color in the levelplot function in the lattice package when already using a col.region?

im using the levelplot function of the lattice-package to display the results in a simulation study of detecting serial independance in simulated AR-time series under different alternatives. As a ...
0 votes
1 answer
141 views

Errors in loading the "caret" library

I have initially successfully installed the caret package through install.packages("caret") But I have trouble in loading the "caret" library after the execution of the following code. library (...
2 votes
1 answer
312 views

Transparent symbols, solid lines, lattice::xyplot()

I want to plot two quantitative variables, in panels determined by a third factor variable, in R using lattice::xyplot(). I want transparent black symbols, with solid red trend lines. To provide a ...
0 votes
1 answer
995 views

saving and naming files in R automatically based on input filename

I have generated several Utilisation Distributions (UD) with AdehabitatHR and stored them as Geotiffs. I am now using the same UDs with the Lattice package to generate some maps and saving them to a ...
0 votes
1 answer
837 views

Automatically scale x-axis by date range within a factor using xyplot()

I've been trying to write out an R script that will plot the date-temp series for a set of locations that are identified by a Deployment_ID. Ideally, each page of the output pdf would have the name ...
0 votes
1 answer
422 views

contourplot color and labels options in Lattice for R

I am quite new to Lattice and I am stuck with some possibly basic coding. I am using shapefiles and geoTIFFS to produce maps of animals distribution and in particular I have: 1 x point shapefile 2 x ...
0 votes
1 answer
1k views

ModelSim Fatal error in process RAM_i1/RAM_0_0_0/P107 Lattice MACHXO3L_MISC.vhd

I am facing a fatal error when trying to simulate in ModelSim a design that instantiates a RAM IP for the target device MACHXO3L from Lattice Semiconductor. I have compiled their libraries to use in ...
0 votes
1 answer
992 views

R: How do I set two titles (main and sub-title) in each lattice xyplot?

I have a sample data in my R dataframe: d <- read.table(text = "Grp Var Col1 Col2 Col3 Sub_grp grp_1 8 46.8 50.0 50.6 A grp_1 16 95.6 47.4 48.0 A grp_1 24 ...
1 vote
0 answers
199 views

How to edit ylab2 on doubleYScale?

i need edit to ylab2 in latticeExtra::doubleYScale. How your observe in Figure, the legend of axis y and axis y2, haven different size. How i can put the same size (cex=1.4)? script: require(...
1 vote
2 answers
145 views

adding different curves to plots in R

I know I can add the same curve to each plot pane as a layer using lattice and latticeExtra R packages (see blow). But suppose we wanted to add different curves to each plot pane. For example, in ...
0 votes
0 answers
404 views

Adjacancy matrix for a square lattice in C++

I am trying to write a code in C++ for calculating the adjacency matrix for a N by N square lattice graph, i.e a graph in which all (i,j) nodes are connected with (i+1,j),(i-1,j),(i,j-1), and (i,j+1) ...
1 vote
1 answer
71 views

coloring the area under a curve for multiple plots in R

I was wondering if I could color the area under the same curves in my plots below? library(lattice) library(latticeExtra) foo <- xyplot((1:32*.01)~wt|gear , data = mtcars) foo + layer(panel....
1 vote
1 answer
41 views

add the same density curve to a plot in R

I was wondering how I could add the same density curve to an xyplot() from lattice package in R (see reproducible code below)? library(lattice) xyplot((1:32*.01)~wt|gear , data = mtcars) lines(...
0 votes
1 answer
477 views

using grid to annotate lattice plots outside of the plotting region

I often use the lattice package to create figures. I then use grid::grid.text() to annotate the figures outside of the plotting region. Typically, I make PDF files, and there are no problems. I now ...
1 vote
1 answer
1k views

Add text to xyplot with panel.superpose

I've created a plot with xyplot, which must show two groups of dots and they're regression line. xyplot(log(Vegetati)~log(Reprod), type=c("p", "r"), group=Espece, data=plantes, ...
1 vote
2 answers
127 views

adding strip to single dotplot from lattice package

I have a situation where I have two different kind of plots and I need to plot them together along with strips on their top stating their heading. I have to use lattice package only thus ggplot2 is ...
1 vote
2 answers
1k views

R lattice title font size

I need my title on the graph to look like the following Main Submain where main is of a different font size than submain, right now I have it as main="Main \n submain" but how do I specify ...
0 votes
1 answer
29 views

lattice xyplot 3x3 arrangement

I have 3 xyplots from lattice. Up to now I have only ever used print(pd1, split = c(1,1,2,2), more = TRUE) print(pd2, split = c(2, 1, 2, 2), more = TRUE) etc (using split) to arrange plots in 2x2 ...
1 vote
3 answers
899 views

Change colors of x-axis labels in dotplot from Lattice package R

I was wondering if there was a way to change the color of certain x-axis labels on a dotplot that I created using the lattice package in R. This is an example of my data/code: State <- factor(c("...
1 vote
2 answers
54 views

How to Pass a Large Data Set to a Function Without an Argument in C

I'm trying to create a general Lanczos algorithm that takes in an operator (function pointer) and prints a certain number of eigenvalues from that operator in C. I'm using the GNU Scientific Library ...
0 votes
1 answer
344 views

Meaning of "@" operator in R language?

I came across the following and I haven't figured out the purpose of the "@" operator. What's the meaning there? I didn't make heads/tails of the R manual language. library(lattice) library(sp) ...
0 votes
1 answer
609 views

Dot Plot include vertical line and dots of different colors

I needed to include in the code below, a vertical line, for example, in position x = 5 and that all points smaller than 5 have another color, for example blue. The values of a variable can be read ...
0 votes
1 answer
64 views

Caret::calibration duplicating data when including multiple model columns in the formula

Not sure if this is a bug or my understanding is flawed, but when I run the following example: library(caret) data(mdrr) mdrrDescr <- mdrrDescr[, -nearZeroVar(mdrrDescr)] mdrrDescr <- mdrrDescr[...

1 2 3
4
5
26