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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:59:18+00:00 2026-05-31T09:59:18+00:00

The initial square matrix looks like this: [,1] [,2] [,3] [,4] [,5] [,6] [1,]

  • 0

The initial square matrix looks like this:

       [,1]        [,2]        [,3]        [,4]        [,5]        [,6]
[1,] 0.00000000 -0.03071266 -0.05202358 -0.06372259 -0.07458787 -0.09827112
[2,] 0.03071266  0.00000000 -0.02131092 -0.03300993 -0.04387521 -0.06755846
[3,] 0.05202358  0.02131092  0.00000000 -0.01169902 -0.02256430 -0.04624754
[4,] 0.06372259  0.03300993  0.01169902  0.00000000 -0.01086528 -0.03454853
[5,] 0.07458787  0.04387521  0.02256430  0.01086528  0.00000000 -0.02368325
[6,] 0.09827112  0.06755846  0.04624754  0.03454853  0.02368325  0.00000000
[7,] 0.13357242  0.10285976  0.08154884  0.06984982  0.05898454  0.03530130
[8,] 0.16375877  0.13304611  0.11173519  0.10003618  0.08917089  0.06548765
        [,7]        [,8]
[1,] -0.13357242 -0.16375877
[2,] -0.10285976 -0.13304611
[3,] -0.08154884 -0.11173519
[4,] -0.06984982 -0.10003618
[5,] -0.05898454 -0.08917089
[6,] -0.03530130 -0.06548765
[7,]  0.00000000 -0.03018635
[8,]  0.03018635  0.00000000

I can create heatmap like this:

heatmap(impl_spread,symm=TRUE)

But I would like to enter values on top of this.

If I convert this to data frame(to use ggplot), which looks like this as expected:

str(data)
'data.frame':   8 obs. of  8 variables:
 $ X1: num  0 0.0307 0.052 0.0637 0.0746 ...
 $ X2: num  -0.0307 0 0.0213 0.033 0.0439 ...
 $ X3: num  -0.052 -0.0213 0 0.0117 0.0226 ...
 $ X4: num  -0.0637 -0.033 -0.0117 0 0.0109 ...
 $ X5: num  -0.0746 -0.0439 -0.0226 -0.0109 0 ...
 $ X6: num  -0.0983 -0.0676 -0.0462 -0.0345 -0.0237 ...
 $ X7: num  -0.1336 -0.1029 -0.0815 -0.0698 -0.059 ...
 $ X8: num  -0.1638 -0.133 -0.1117 -0.1 -0.0892 ...

And, then,

a<-c("1M","3M","6M","9M","1Y","2Y","5Y","10Y")
impl_spread[,ncol(impl_spread)+1]<-a
attach(impl_spread)
impl_spread.m<-melt(impl_spread)
impl_spread.m <- ddply(impl_spread.m, .(variable), transform, rescale = rescale(value))
ggplot(impl_spread.m,aes(V9," ")) + geom_tile(aes(fill = rescale),
colour =   "white") + scale_fill_gradient(low = "white", high = "steelblue")

This doesn’t seem to produce right plot. Please help.

Thanks in advance.

  • 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-31T09:59:19+00:00Added an answer on May 31, 2026 at 9:59 am

    Try this,

    library(reshape2)
    library(ggplot2)
    m = matrix(rnorm(20),5)
    ggplot(melt(m), aes(Var1,Var2, fill=value)) + geom_raster()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My initial strategy at developing forms was like this: the form post back to
I have got a square matrix consisting of elements either 1 or 0. An
I have a PathGeometry defining some path like this one: original path http://devblog.ailon.org/devblog/_stuff/wpfpathgeoquestion/original.gif This
My initial look at Jersey suggested this was a nice framework that made it
I got interested in this question someone posted yesterday about diamond-square algorithms, Node.js /
Initial Problem protected function _initMail() { $this->bootstrap('mail'); } in my Bootstrap.php Fails with a:
INITIAL NOTE: This is just for a personal tinkering project; I'm not writing enterprise
Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my
My initial question was here and was related to the postgres backend. Postgres subquery,
When prototyping initial GUI functionality with a customer is it better to use a

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.