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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:14:57+00:00 2026-05-30T07:14:57+00:00

I am using level plots from the R lattice package. My resulting plots look

  • 0

I am using level plots from the R lattice package. My resulting plots look like the one shown below.

My problem now is that I need to generate a black and white version for printing.

Is there a way to change the colors to grayscale and give the rectangles a background pattern so the the red once are distinguishable from the blue ones? For example, dots or diagonal dashes come to mind.

Thanks!

Example image

  • 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-05-30T07:14:59+00:00Added an answer on May 30, 2026 at 7:14 am

    I found a way to manually draw into the levelplot panel and to draw a diagonal fill pattern over all cells with values greater than 0.5

    However, I couldn’t manage to draw the same pattern in the color key legend. After hours of reading forums and trying to understand the lattice source code, I couldn’t get a clue. Maybe someone else could fix that. Here is what I got:

    library(lattice)
    library(RColorBrewer)
    cols <- colorRampPalette(brewer.pal(8, "RdBu"))
    
    data <- Harman23.cor$cov    
    
    fx <- fy <- c()
    for (r in seq(nrow(data)))
      for (c in seq(ncol(data)))
      {
        if (data[r, c] > 0.5)
        {
          fx <- c(fx, r);
          fy <- c(fy, c);
        }
      }
    
    diag_pattern <- function(...)
    {
      panel.levelplot(...)
      for (i in seq(length(fx)))
      {
        panel.linejoin(x = c(fx[i],fx[i]+.5), y= c(fy[i]+.5,fy[i]), col="black")
        panel.linejoin(x = c(fx[i]-.5,fx[i]+.5), y= c(fy[i]+.5,fy[i]-.5), col="black")
        panel.linejoin(x = c(fx[i]-.5,fx[i]), y= c(fy[i],fy[i]-.5), col="black")   
      }
    }      
    
    p <- levelplot(data, scales=list(x=list(rot=45)), 
                   xlab="", ylab="", col.regions=cols, panel=diag_pattern)
    print(p)
    

    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'd like to initialize some top-level constants using float::consts::pi . For example: import float::consts::pi;
I am drawing box-percentile plots in R, using the box-percentile panel function from Hmisc
When using system-level IO in Linux, I noticed that the compiler recognized the O_RDONLY
I would like to have my warnings set to the highest level using Microsoft
How can I set a transaction isolation level using Squeryl? For instance, right now
I'm using python with matplotlib to create plots out of data, an I'd like
I am using 2nd level cache and query cache. May I know how to
I've an app using low level CoreAudio C functions, usually located under /Volumes/Xcode/Xcode.app/Contents/Developer/Extras/CoreAudio/PublicUtility/. Just
I've been looking into implementing caching at Repository level using the .NET 4.0 Caching
When using Hibernate 2nd level cache and query cache and not specifying anything inside

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.